| @ -0,0 +1,14 @@ | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace ButcherManage.BO | |||
| { | |||
| [KeyField("ID", KeyGenType.identity)] | |||
| public abstract class Base | |||
| { | |||
| public long ID { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,14 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace ButcherManage.BO | |||
| { | |||
| public abstract class BaseInfo | |||
| { | |||
| public long ID { get; set; } | |||
| public string Name { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,20 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace ButcherManage.BO | |||
| { | |||
| public class ExtensionObj | |||
| { | |||
| public long? LongExt1 { get; set; } | |||
| public long? LongExt2 { get; set; } | |||
| public decimal? DecimalExt1 { get; set; } | |||
| public string StringExt1 { get; set; } | |||
| public string StringExt2 { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,14 @@ | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace ButcherManage.BO | |||
| { | |||
| [MapToTable("Butcher_ProductBatch")] | |||
| public class ProductBatch : BaseInfo | |||
| { | |||
| public DateTime? Date { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,25 @@ | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Data; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace ButcherManage.BO | |||
| { | |||
| [MapToTable("Butcher_Worker")] | |||
| public class Worker : BaseInfo | |||
| { | |||
| public string Code { get; set; } | |||
| [DbColumn(AllowNull = false, DbType = SqlDbType.Binary, Length = 16)] | |||
| public byte[] Password { get; set; } | |||
| public string Role { get; set; } | |||
| [NonDmoProperty] | |||
| public IEnumerable<short> RoleList | |||
| { | |||
| get { return Role.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => short.Parse(x)); } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,23 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace ButcherManage.BO | |||
| { | |||
| public class PickOutConfirmDmo | |||
| { | |||
| public long ID { get; set; } | |||
| public int Order { get; set; } | |||
| public int PlanNumber { get; set; } | |||
| public string LiveColonyHouse_Name { get; set; } | |||
| public int? AlreadyNumber { get; set; } | |||
| //0:未开始,1:开始,-1:结束 | |||
| public int ConfirmState { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,18 @@ | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace ButcherManage.BO | |||
| { | |||
| [MapToTable("Butcher_PickOutConfirmLocal")] | |||
| [KeyField("ID", KeyGenType.assigned)] | |||
| public class PickOutConfirmLocal | |||
| { | |||
| public long ID { get; set; } | |||
| public int AlreadyNumber { get; set; } | |||
| //0:未开始,1:开始,-1:结束 | |||
| public int ConfirmState { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,15 @@ | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace ButcherManage.BO | |||
| { | |||
| [MapToTable("Butcher_PickOutRecord")] | |||
| public class PickOutRecord : Base | |||
| { | |||
| public long Order_ID { get; set; } | |||
| public int? Number { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,86 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
| <PropertyGroup> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
| <ProjectGuid>{B1ECBE2F-06FB-4E4C-9487-1497E0808C04}</ProjectGuid> | |||
| <OutputType>Library</OutputType> | |||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||
| <RootNamespace>ButcherManage.BO</RootNamespace> | |||
| <AssemblyName>ButcherManage.BO</AssemblyName> | |||
| <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| <TargetFrameworkProfile /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| <DebugType>full</DebugType> | |||
| <Optimize>false</Optimize> | |||
| <OutputPath>bin\Debug\</OutputPath> | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
| <DebugType>pdbonly</DebugType> | |||
| <Optimize>true</Optimize> | |||
| <OutputPath>bin\Release\</OutputPath> | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="Forks.EnterpriseServices, Version=3.1.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||
| <SpecificVersion>False</SpecificVersion> | |||
| <HintPath>..\..\..\tsref\release\Forks.EnterpriseServices.dll</HintPath> | |||
| </Reference> | |||
| <Reference Include="Forks.Utils, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||
| <SpecificVersion>False</SpecificVersion> | |||
| <HintPath>..\..\..\tsref\release\Forks.Utils.dll</HintPath> | |||
| </Reference> | |||
| <Reference Include="Newtonsoft.Json, Version=4.0.3.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | |||
| <SpecificVersion>False</SpecificVersion> | |||
| <HintPath>..\..\..\tsref\release\Newtonsoft.Json.dll</HintPath> | |||
| </Reference> | |||
| <Reference Include="System" /> | |||
| <Reference Include="System.Core" /> | |||
| <Reference Include="System.Windows.Forms" /> | |||
| <Reference Include="System.Xml.Linq" /> | |||
| <Reference Include="System.Data.DataSetExtensions" /> | |||
| <Reference Include="Microsoft.CSharp" /> | |||
| <Reference Include="System.Data" /> | |||
| <Reference Include="System.Xml" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Compile Include="BaseInfo\ProductBatch.cs" /> | |||
| <Compile Include="BaseInfo\Worker.cs" /> | |||
| <Compile Include="Base\Base.cs" /> | |||
| <Compile Include="Base\BaseInfo.cs" /> | |||
| <Compile Include="Base\ExtensionObj.cs" /> | |||
| <Compile Include="Bill\PickOutConfirmDmo.cs" /> | |||
| <Compile Include="Bill\PickOutConfirmLocal.cs" /> | |||
| <Compile Include="Bill\PickOutRecord.cs" /> | |||
| <Compile Include="Enums\DriveType.cs" /> | |||
| <Compile Include="LocalBL\PickOutConfirmBL.cs" /> | |||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||
| <Compile Include="Utils\AppContext.cs" /> | |||
| <Compile Include="Utils\ClientRpc.cs" /> | |||
| <Compile Include="Utils\DbUtil.cs" /> | |||
| <Compile Include="Utils\Extensions.cs" /> | |||
| <Compile Include="Utils\FormUtil.cs" /> | |||
| <Compile Include="Utils\LoginUtil.cs" /> | |||
| <Compile Include="Utils\XmlUtil.cs" /> | |||
| </ItemGroup> | |||
| <ItemGroup /> | |||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||
| Other similar extension points exist, see Microsoft.Common.targets. | |||
| <Target Name="BeforeBuild"> | |||
| </Target> | |||
| <Target Name="AfterBuild"> | |||
| </Target> | |||
| --> | |||
| </Project> | |||
| @ -0,0 +1,13 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| namespace ButcherManage.BO.Enums | |||
| { | |||
| public enum 设备类别 | |||
| { | |||
| 赶猪确认 = 103, | |||
| } | |||
| } | |||
| @ -0,0 +1,104 @@ | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace ButcherManage.BO.LocalBL | |||
| { | |||
| public static class PickOutConfirmBL | |||
| { | |||
| public static List<PickOutConfirmDmo> GetDmoList(DateTime butcherDate) | |||
| { | |||
| var json = SimpleRest.Call<string>("/MainSystem/B3ClientService/Rpcs/PickOutConfirmRpc/GetList", butcherDate); | |||
| var list = JsonConvert.DeserializeObject<List<PickOutConfirmDmo>>(json); | |||
| FillDetailWithLocal(list); | |||
| return list; | |||
| } | |||
| static void FillDetailWithLocal(List<PickOutConfirmDmo> list) | |||
| { | |||
| var query = new DQueryDom(new JoinAlias(typeof(PickOutConfirmLocal))); | |||
| query.Columns.Add(DQSelectColumn.Field("ID")); | |||
| query.Columns.Add(DQSelectColumn.Field("AlreadyNumber")); | |||
| query.Columns.Add(DQSelectColumn.Field("ConfirmState")); | |||
| query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), list.Select(x => DQExpression.Value(x.ID)).ToArray())); | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| using (var reader = session.ExecuteReader(query)) | |||
| { | |||
| while (reader.Read()) | |||
| { | |||
| var first = list.First(x => x.ID == (long)reader[0]); | |||
| first.AlreadyNumber = (int)reader[1]; | |||
| first.ConfirmState = (int)reader[2]; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| public static void ChangeState(long id, int state) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| Update<PickOutConfirmLocal>(session, id, "ConfirmState", state); | |||
| session.Commit(); | |||
| } | |||
| } | |||
| public static void SaveRecord(PickOutRecord record) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| if (record.ID == 0) | |||
| session.Insert(record); | |||
| else | |||
| session.Update(record); | |||
| UpdateAlreadyNumber(session, record.Order_ID); | |||
| session.Commit(); | |||
| } | |||
| } | |||
| static void UpdateAlreadyNumber(IDmoSession session, long id) | |||
| { | |||
| var query = new DQueryDom(new JoinAlias(typeof(PickOutRecord))); | |||
| query.Columns.Add(DQSelectColumn.Sum("Number")); | |||
| query.Where.Conditions.Add(DQCondition.EQ("Order_ID", id)); | |||
| var num = query.EExecuteScalar<int>(session); | |||
| Update<PickOutConfirmLocal>(session, id, "AlreadyNumber", num); | |||
| } | |||
| static void Update<T>(IDmoSession session, long id, string file, object value) | |||
| where T : new() | |||
| { | |||
| var type = typeof(T); | |||
| var query = new DQueryDom(new JoinAlias(type)); | |||
| query.Where.Conditions.Add(DQCondition.EQ("ID", id)); | |||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "c")); | |||
| if (query.EExecuteScalar(session) == null) | |||
| { | |||
| var entity = new T(); | |||
| type.GetProperty("ID").SetValue(entity, id); | |||
| type.GetProperty(file).SetValue(entity, value); | |||
| session.Insert(entity); | |||
| } | |||
| else | |||
| { | |||
| var update = new DQUpdateDom(type); | |||
| update.Where.Conditions.Add(DQCondition.EQ("ID", id)); | |||
| update.Columns.Add(new DQUpdateColumn(file, value)); | |||
| session.ExecuteNonQuery(update); | |||
| } | |||
| } | |||
| public static List<PickOutRecord> GetRecordList(long id) | |||
| { | |||
| var query = new DmoQuery(typeof(PickOutRecord)); | |||
| query.Where.Conditions.Add(DQCondition.EQ("Order_ID", id)); | |||
| query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID")); | |||
| return query.EExecuteList().Cast<PickOutRecord>().ToList(); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,36 @@ | |||
| using System.Reflection; | |||
| using System.Runtime.CompilerServices; | |||
| using System.Runtime.InteropServices; | |||
| // 有关程序集的常规信息通过以下 | |||
| // 特性集控制。更改这些特性值可修改 | |||
| // 与程序集关联的信息。 | |||
| [assembly: AssemblyTitle("ButcherManage.BO")] | |||
| [assembly: AssemblyDescription("")] | |||
| [assembly: AssemblyConfiguration("")] | |||
| [assembly: AssemblyCompany("")] | |||
| [assembly: AssemblyProduct("ButcherManage.BO")] | |||
| [assembly: AssemblyCopyright("Copyright © 2018")] | |||
| [assembly: AssemblyTrademark("")] | |||
| [assembly: AssemblyCulture("")] | |||
| // 将 ComVisible 设置为 false 使此程序集中的类型 | |||
| // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, | |||
| // 则将该类型上的 ComVisible 特性设置为 true。 | |||
| [assembly: ComVisible(false)] | |||
| // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | |||
| [assembly: Guid("312215bc-b734-42cd-a529-6f3b28bfce7f")] | |||
| // 程序集的版本信息由下面四个值组成: | |||
| // | |||
| // 主版本 | |||
| // 次版本 | |||
| // 生成号 | |||
| // 修订号 | |||
| // | |||
| // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, | |||
| // 方法是按如下所示使用“*”: | |||
| // [assembly: AssemblyVersion("1.0.*")] | |||
| [assembly: AssemblyVersion("1.0.0.0")] | |||
| [assembly: AssemblyFileVersion("1.0.0.0")] | |||
| @ -0,0 +1,50 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace ButcherManage.BO.Utils | |||
| { | |||
| public static class AppContext | |||
| { | |||
| static ServerUrlConfig _connectInfo = ServerUrlConfig.Init(); | |||
| public static ServerUrlConfig ConnectInfo { get { return _connectInfo; } } | |||
| static Worker _worker = null; | |||
| public static Worker Worker | |||
| { | |||
| get | |||
| { | |||
| if (_worker == null) | |||
| _worker = LoginUtil.InitUserFromLocal(); | |||
| return _worker; | |||
| } | |||
| } | |||
| } | |||
| public class ServerUrlConfig | |||
| { | |||
| public static ServerUrlConfig Init() | |||
| { | |||
| return XmlUtil.DeserializeFromFile<ServerUrlConfig>(); | |||
| } | |||
| public string ServerUrl { get; set; } | |||
| public bool LocalOffline { get; set; } | |||
| public string SqlConnection { get; set; } | |||
| private string _traceBackUrl = "default"; | |||
| public string TraceBackUrl | |||
| { | |||
| get { return _traceBackUrl; } | |||
| set { _traceBackUrl = value; } | |||
| } | |||
| public void Save() | |||
| { | |||
| XmlUtil.SerializerObjToFile(this); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,141 @@ | |||
| using ButcherManage.BO.Utils; | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.IO; | |||
| using System.Linq; | |||
| using System.Net; | |||
| using System.Text; | |||
| namespace ButcherManage.BO | |||
| { | |||
| public static class SimpleRest { | |||
| static ClientRpc clientRpc; | |||
| public static T Call<T>(string method, params object[] args) | |||
| { | |||
| InitClientRpc(); | |||
| return clientRpc.Call<T>(method, args); | |||
| } | |||
| static void InitClientRpc() | |||
| { | |||
| if (clientRpc != null) | |||
| return; | |||
| if (string.IsNullOrEmpty(AppContext.ConnectInfo.ServerUrl)) | |||
| throw new Exception("请先配置服务器地址"); | |||
| clientRpc = new ClientRpc(AppContext.ConnectInfo.ServerUrl); | |||
| } | |||
| } | |||
| public class ClientRpc | |||
| { | |||
| public ClientRpc(string url) | |||
| { | |||
| mUrl = url; | |||
| } | |||
| class _Error | |||
| { | |||
| public int? code { get; set; } | |||
| public string message { get; set; } | |||
| } | |||
| class _ErrorResposne | |||
| { | |||
| public _Error error { get; set; } | |||
| } | |||
| string mUrl; | |||
| public string Url | |||
| { | |||
| get | |||
| { | |||
| return mUrl; | |||
| } | |||
| } | |||
| public T Call<T>(string method, params object[] args) | |||
| { | |||
| var resp = DoCall<T>(method, args); | |||
| if (resp.error != null) | |||
| { | |||
| throw new Exception(string.Format("{0}:{1}", resp.error.code, resp.error.message)); | |||
| } | |||
| return resp.result; | |||
| } | |||
| LRestClientReponse<T> DoCall<T>(string method, object[] args) | |||
| { | |||
| var request = (HttpWebRequest)WebRequest.Create(mUrl); | |||
| request.Method = "POST"; | |||
| request.ContentType = "application/json"; | |||
| var dic = new Dictionary<string, object>(); | |||
| dic.Add("method", method); | |||
| dic.Add("id", 1); | |||
| dic.Add("params", args); | |||
| var json = JsonConvert.SerializeObject(dic); | |||
| var buffer = Encoding.UTF8.GetBytes(json); | |||
| var requestStream = request.GetRequestStream(); | |||
| requestStream.Write(buffer, 0, buffer.Length); | |||
| var responseJson = GetResponseJSON(request); | |||
| try | |||
| { | |||
| var result = JsonConvert.DeserializeObject<LRestClientReponse<T>>(responseJson); | |||
| return result; | |||
| } | |||
| catch | |||
| { | |||
| try | |||
| { | |||
| var errorResponse = JsonConvert.DeserializeObject<_ErrorResposne>(responseJson); | |||
| if (errorResponse.error != null) | |||
| { | |||
| throw new Exception(errorResponse.error.message); | |||
| } | |||
| } | |||
| catch | |||
| { | |||
| throw new Exception("JSON反序列化失败:" + responseJson); | |||
| } | |||
| throw new Exception("JSON反序列化失败:" + responseJson); | |||
| } | |||
| } | |||
| public class LRestClientReponseError | |||
| { | |||
| public string code { get; set; } | |||
| public string message { get; set; } | |||
| public override string ToString() | |||
| { | |||
| return string.Format("{0}:{1}", code, message); | |||
| } | |||
| } | |||
| public class LRestClientReponse<T> | |||
| { | |||
| public long id { get; set; } | |||
| public LRestClientReponseError error { get; set; } | |||
| public T result { get; set; } | |||
| } | |||
| private static string GetResponseJSON(HttpWebRequest request) | |||
| { | |||
| var response = request.GetResponse(); | |||
| using (var stream = response.GetResponseStream()) | |||
| { | |||
| using (var reader = new StreamReader(stream, Encoding.UTF8)) | |||
| { | |||
| return reader.ReadToEnd(); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,49 @@ | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.Utils; | |||
| using Forks.Utils.Data; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Reflection; | |||
| using System.Text; | |||
| namespace ButcherManage.BO.Utils | |||
| { | |||
| public static class DbUtil | |||
| { | |||
| public static void UpdateDatabase(string sqlConnection) | |||
| { | |||
| using (ISqlUtil sqlUtil = new SqlUtil(sqlConnection)) | |||
| { | |||
| var boTypes = GetTypes(); | |||
| Dmo.UpdateTables(sqlUtil, boTypes); | |||
| } | |||
| } | |||
| static IEnumerable<Type> GetTypes() | |||
| { | |||
| var asm = Assembly.GetExecutingAssembly(); | |||
| foreach (var t in asm.GetExportedTypes()) | |||
| { | |||
| if (t.IsAbstract) | |||
| { | |||
| continue; | |||
| } | |||
| if (t.IsClass && IsMapTable(t)) | |||
| { | |||
| yield return t; | |||
| } | |||
| } | |||
| } | |||
| static bool IsMapTable(Type t) | |||
| { | |||
| var attr = ReflectionUtil.GetAttribute<MapToTableAttribute>(t); | |||
| if (attr == null) | |||
| { | |||
| return false; | |||
| } | |||
| return true; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,319 @@ | |||
| using ButcherManage.BO.Utils; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using Forks.Utils; | |||
| using System; | |||
| using System.Collections; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace ButcherManage.BO | |||
| { | |||
| public static class DmoSession | |||
| { | |||
| public static IDmoSessionWithTransaction New() | |||
| { | |||
| return Dmo.NewSession(AppContext.ConnectInfo.SqlConnection); | |||
| } | |||
| } | |||
| public static class Extensions | |||
| { | |||
| public static object EExecuteScalar(this DQueryDom query, IDmoSession session) | |||
| { | |||
| return session.ExecuteScalar(query); | |||
| } | |||
| public static object EExecuteScalar(this DQueryDom query) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| return query.EExecuteScalar(session); | |||
| } | |||
| } | |||
| public static T EExecuteScalar<T>(this DQueryDom query, IDmoSession session) | |||
| { | |||
| return (T)query.EExecuteScalar(session); | |||
| } | |||
| public static T EExecuteScalar<T>(this DQueryDom query) | |||
| { | |||
| return (T)query.EExecuteScalar(); | |||
| } | |||
| public static Tuple<T1, T2> EExecuteScalar<T1, T2>(this DQueryDom query, IDmoSession session) | |||
| { | |||
| var list = query.EExecuteList<T1, T2>(session); | |||
| if (list.Count == 0) | |||
| { | |||
| return null; | |||
| } | |||
| #if DEBUG | |||
| if (list.Count > 1) | |||
| { | |||
| throw new Exception(string.Format("期望返回1条记录实际返回{0}条", list.Count)); | |||
| } | |||
| #endif | |||
| return list[0]; | |||
| } | |||
| public static Tuple<T1, T2> EExecuteScalar<T1, T2>(this DQueryDom query) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| return query.EExecuteScalar<T1, T2>(session); | |||
| } | |||
| } | |||
| public static Tuple<T1, T2, T3> EExecuteScalar<T1, T2, T3>(this DQueryDom query, IDmoSession session) | |||
| { | |||
| var list = query.EExecuteList<T1, T2, T3>(session); | |||
| if (list.Count == 0) | |||
| { | |||
| return null; | |||
| } | |||
| #if DEBUG | |||
| if (list.Count > 1) | |||
| { | |||
| throw new Exception(string.Format("期望返回1条记录实际返回{0}条", list.Count)); | |||
| } | |||
| #endif | |||
| return list[0]; | |||
| } | |||
| public static Tuple<T1, T2, T3> EExecuteScalar<T1, T2, T3>(this DQueryDom query) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| return query.EExecuteScalar<T1, T2, T3>(session); | |||
| } | |||
| } | |||
| public static T EExecuteScalar<T>(this DmoQuery query) where T : class | |||
| { | |||
| var result = query.EExecuteList(); | |||
| if (result.Count == 0) | |||
| { | |||
| return default(T); | |||
| } | |||
| if (result.Count > 1) | |||
| { | |||
| throw new Exception("ExecuteScalar返回多个数据"); | |||
| } | |||
| return (T)result[0]; | |||
| } | |||
| public static List<T> EExecuteList<T>(this DQueryDom query, IDmoSession session) | |||
| { | |||
| var list = new List<T>(); | |||
| using (var reader = session.ExecuteReader(query)) | |||
| { | |||
| while (reader.Read()) | |||
| { | |||
| list.Add((T)reader[0]); | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| public static List<T> EExecuteList<T>(this DQueryDom query) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| return query.EExecuteList<T>(session); | |||
| } | |||
| } | |||
| public static List<TDmo> EExecuteDmoList<TDmo>(this DQueryDom query, IDmoSession session, params string[] fields) where TDmo : new() | |||
| { | |||
| var type = typeof(TDmo); | |||
| PCheck.IsTrue(query.From.RootSource.Alias.DmoSource == DmoInfo.Get(type)); | |||
| var dmoInfo = DmoInfo.Get(type); | |||
| if (fields.Length == 0) | |||
| { | |||
| fields = dmoInfo.Fields | |||
| .Select((item) => item.Name).ToArray(); | |||
| } | |||
| #if DEBUG | |||
| else | |||
| { | |||
| foreach (var filed in fields) | |||
| { | |||
| if (!dmoInfo.Fields.Contains(filed)) | |||
| { | |||
| throw new Exception(string.Format("对象{0}上不存在字段{1}的定义", type.Name, filed)); | |||
| } | |||
| } | |||
| } | |||
| #endif | |||
| if (query.Columns.Count == 0) | |||
| { | |||
| foreach (var filed in fields) | |||
| { | |||
| query.Columns.Add(DQSelectColumn.Field(filed)); | |||
| } | |||
| } | |||
| else if (query.Columns.Count != fields.Length) | |||
| { | |||
| throw new Exception("查询字段数量不匹配"); | |||
| } | |||
| var indexSetDic = fields.ToDictionary((item) => Array.IndexOf<string>(fields, item), (item) => type.GetProperty(item).GetSetMethod()); | |||
| var list = new List<TDmo>(); | |||
| using (var reader = session.ExecuteReader(query)) | |||
| { | |||
| while (reader.Read()) | |||
| { | |||
| var dmo = new TDmo(); | |||
| list.Add(dmo); | |||
| foreach (var pair in indexSetDic) | |||
| { | |||
| pair.Value.Invoke(dmo, new object[] { reader[pair.Key] }); | |||
| } | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| public static List<TDmo> EExecuteDmoList<TDmo>(this DQueryDom query, params string[] fields) where TDmo : new() | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| return query.EExecuteDmoList<TDmo>(session, fields); | |||
| } | |||
| } | |||
| public static List<Tuple<T1, T2>> EExecuteList<T1, T2>(this DQueryDom query, IDmoSession session) | |||
| { | |||
| var list = new List<Tuple<T1, T2>>(); | |||
| using (var reader = session.ExecuteReader(query)) | |||
| { | |||
| while (reader.Read()) | |||
| { | |||
| var value = new Tuple<T1, T2>( | |||
| (T1)reader[0], | |||
| (T2)reader[1]); | |||
| list.Add(value); | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| public static List<Tuple<T1, T2>> EExecuteList<T1, T2>(this DQueryDom query) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| return query.EExecuteList<T1, T2>(session); | |||
| } | |||
| } | |||
| public static List<Tuple<T1, T2, T3>> EExecuteList<T1, T2, T3>(this DQueryDom query, IDmoSession session) | |||
| { | |||
| var list = new List<Tuple<T1, T2, T3>>(); | |||
| using (var reader = session.ExecuteReader(query)) | |||
| { | |||
| while (reader.Read()) | |||
| { | |||
| var value = new Tuple<T1, T2, T3>( | |||
| (T1)reader[0], | |||
| (T2)reader[1], | |||
| (T3)reader[2]); | |||
| list.Add(value); | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| public static List<Tuple<T1, T2, T3>> EExecuteList<T1, T2, T3>(this DQueryDom query) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| return query.EExecuteList<T1, T2, T3>(session); | |||
| } | |||
| } | |||
| public static List<Tuple<T1, T2, T3, T4>> EExecuteList<T1, T2, T3, T4>(this DQueryDom query) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| return query.EExecuteList<T1, T2, T3, T4>(session); | |||
| } | |||
| } | |||
| public static List<Tuple<T1, T2, T3, T4>> EExecuteList<T1, T2, T3, T4>(this DQueryDom query, IDmoSession session) | |||
| { | |||
| var list = new List<Tuple<T1, T2, T3, T4>>(); | |||
| using (var reader = session.ExecuteReader(query)) | |||
| { | |||
| while (reader.Read()) | |||
| { | |||
| var value = new Tuple<T1, T2, T3, T4>( | |||
| (T1)reader[0], | |||
| (T2)reader[1], | |||
| (T3)reader[2], (T4)reader[3]); | |||
| list.Add(value); | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| public static List<Tuple<T1, T2, T3, T4, T5>> EExecuteList<T1, T2, T3, T4, T5>(this DQueryDom query) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| return query.EExecuteList<T1, T2, T3, T4, T5>(session); | |||
| } | |||
| } | |||
| public static List<Tuple<T1, T2, T3, T4, T5>> EExecuteList<T1, T2, T3, T4, T5>(this DQueryDom query, IDmoSession session) | |||
| { | |||
| var list = new List<Tuple<T1, T2, T3, T4, T5>>(); | |||
| using (var reader = session.ExecuteReader(query)) | |||
| { | |||
| while (reader.Read()) | |||
| { | |||
| var value = new Tuple<T1, T2, T3, T4, T5>( | |||
| (T1)reader[0], | |||
| (T2)reader[1], | |||
| (T3)reader[2], (T4)reader[3], (T5)reader[4]); | |||
| list.Add(value); | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| public static IList EExecuteList(this DmoQuery query) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| return session.ExecuteList(query); | |||
| } | |||
| } | |||
| public static void EExecute(this DQUpdateDom update) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| session.ExecuteNonQuery(update); | |||
| session.Commit(); | |||
| } | |||
| } | |||
| public static void EExecute(this DQDeleteDom delete) | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| session.ExecuteNonQuery(delete); | |||
| session.Commit(); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,43 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Windows.Forms; | |||
| using System.IO; | |||
| using System.Reflection; | |||
| namespace ButcherManage.BO.Utils | |||
| { | |||
| public static class FormUtil | |||
| { | |||
| public static Form CreateFrom() | |||
| { | |||
| var dll = Path.Combine(Environment.CurrentDirectory, "ButcherManage.Form.dll"); | |||
| if (!File.Exists(dll)) | |||
| throw new Exception("缺少必要的程序集文件 ButcherManage.Form.dll"); | |||
| var formType = typeof(IWithRoleForm); | |||
| Form form = null; | |||
| foreach (var type in Assembly.LoadFile(dll).GetTypes()) | |||
| { | |||
| if (formType.IsAssignableFrom(type)) | |||
| { | |||
| var instance = (IWithRoleForm)Activator.CreateInstance(type); | |||
| foreach (var item in instance.RoleName) | |||
| { | |||
| if (AppContext.Worker.RoleList.Contains(item)) | |||
| return instance.Generate(); | |||
| } | |||
| } | |||
| } | |||
| return form; | |||
| } | |||
| } | |||
| public interface IWithRoleForm | |||
| { | |||
| List<short> RoleName { get; } | |||
| Form Generate(); | |||
| } | |||
| } | |||
| @ -0,0 +1,126 @@ | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.IO; | |||
| using System.Linq; | |||
| using System.Security.Cryptography; | |||
| using System.Text; | |||
| namespace ButcherManage.BO.Utils | |||
| { | |||
| public static class LoginUtil | |||
| { | |||
| const string WORKPATH = "Config\\Worker.ldb"; | |||
| public static Worker InitUserFromLocal() | |||
| { | |||
| var work = new Worker(); | |||
| if (!AppContext.ConnectInfo.LocalOffline) | |||
| { | |||
| if (File.Exists(WORKPATH)) | |||
| work.Name = File.ReadAllText(WORKPATH); | |||
| } | |||
| else | |||
| { | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| var query = new DmoQuery(typeof(Worker)); | |||
| var obj = session.ExecuteScalar(query); | |||
| if (obj != null) | |||
| work = (Worker)obj; | |||
| } | |||
| } | |||
| return work; | |||
| } | |||
| public static string GetWorkerNameByCode(string code) | |||
| { | |||
| string method = "/MainSystem/B3ClientService/Rpcs/LoginRpc/GetWorkerNameByCode"; | |||
| var result = SimpleRest.Call<string>(method, code); | |||
| int r; | |||
| if (int.TryParse(result, out r)) | |||
| { | |||
| if (r == 0) | |||
| throw new Exception("工号输入错误"); | |||
| throw new Exception("账号被停用"); | |||
| } | |||
| else | |||
| { | |||
| AppContext.Worker.Code = code; | |||
| return result; | |||
| } | |||
| } | |||
| public static void Login(string userName, string pwd) | |||
| { | |||
| RpcLogin(userName, pwd); | |||
| AppContext.Worker.Name = userName; | |||
| AppContext.Worker.Password = EncodePwd(pwd); | |||
| if (!AppContext.ConnectInfo.LocalOffline) | |||
| { | |||
| File.WriteAllText(WORKPATH, userName); | |||
| return; | |||
| } | |||
| using (var session = DmoSession.New()) | |||
| { | |||
| var table = DmoInfo.Get(typeof(Worker)).MappedDBObject; | |||
| var sql = string.Format(@"delete from [{0}]", table); | |||
| session.ExecuteSqlNonQuery(sql); | |||
| session.Insert(AppContext.Worker); | |||
| session.Commit(); | |||
| } | |||
| } | |||
| static void RpcLogin(string name, string pwd) | |||
| { | |||
| const string loginMethod = "/MainSystem/B3ClientService/Rpcs/LoginRpc/Login"; | |||
| var r = SimpleRest.Call<long>(loginMethod, name, pwd); | |||
| if (r == 0) | |||
| throw new Exception("用户名密码错误"); | |||
| else if (r == -1) | |||
| throw new Exception("账号被停用"); | |||
| AppContext.Worker.ID = r; | |||
| const string wpfUserMethod = "/MainSystem/B3ClientService/Rpcs/LoginRpc/GetWorkerBindDrive"; | |||
| AppContext.Worker.Role = SimpleRest.Call<string>(wpfUserMethod, AppContext.Worker.ID); | |||
| } | |||
| public static byte[] EncodePwd(string pwd) | |||
| { | |||
| using (MD5 md5 = MD5.Create()) | |||
| return md5.ComputeHash(Encoding.Unicode.GetBytes(pwd)); | |||
| } | |||
| public static bool TestConnection(int? millisecondsTimeout = null) | |||
| { | |||
| var url = AppContext.ConnectInfo.ServerUrl; | |||
| if (string.IsNullOrEmpty(url)) | |||
| return false; | |||
| var uri = new Uri(url); | |||
| if (millisecondsTimeout == null) | |||
| { | |||
| millisecondsTimeout = 50; | |||
| } | |||
| return TestConnection(uri.Host, uri.Port, millisecondsTimeout.Value); | |||
| } | |||
| public static bool TestConnection(string host, int port, int millisecondsTimeout) | |||
| { | |||
| var client = new System.Net.Sockets.TcpClient(); | |||
| try | |||
| { | |||
| var ar = client.BeginConnect(host, port, null, null); | |||
| ar.AsyncWaitHandle.WaitOne(millisecondsTimeout); | |||
| return client.Connected; | |||
| } | |||
| catch (Exception) | |||
| { | |||
| return false; | |||
| } | |||
| finally | |||
| { | |||
| client.Close(); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,47 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.IO; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Xml.Serialization; | |||
| namespace ButcherManage.BO.Utils | |||
| { | |||
| public static class XmlUtil | |||
| { | |||
| static string config = "Config"; | |||
| public static void SerializerObjToFile(object obj, string fileName = "") | |||
| { | |||
| if (string.IsNullOrWhiteSpace(fileName)) | |||
| { | |||
| fileName = Path.Combine(config, obj.GetType().Name + ".xml"); | |||
| } | |||
| var ser = new XmlSerializer(obj.GetType()); | |||
| using (var stream = File.Open(fileName, FileMode.Create)) | |||
| { | |||
| ser.Serialize(stream, obj); | |||
| } | |||
| } | |||
| public static T DeserializeFromFile<T>(string fileName = "") | |||
| where T : new() | |||
| { | |||
| if (string.IsNullOrWhiteSpace(fileName)) | |||
| { | |||
| fileName = Path.Combine(config, typeof(T).Name + ".xml"); | |||
| } | |||
| if (!File.Exists(fileName)) | |||
| { | |||
| return new T(); | |||
| } | |||
| using (var reader = new StreamReader(fileName)) | |||
| { | |||
| var xs = new XmlSerializer(typeof(T)); | |||
| object obj = xs.Deserialize(reader); | |||
| reader.Close(); | |||
| return (T)obj; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,94 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
| <PropertyGroup> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
| <ProjectGuid>{97CECE9B-FDBA-483C-8BFE-CF118DF1A82B}</ProjectGuid> | |||
| <OutputType>Library</OutputType> | |||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||
| <RootNamespace>ButcherManage</RootNamespace> | |||
| <AssemblyName>ButcherManage.Form</AssemblyName> | |||
| <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| <TargetFrameworkProfile /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| <DebugType>full</DebugType> | |||
| <Optimize>false</Optimize> | |||
| <OutputPath>bin\Debug\</OutputPath> | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
| <DebugType>pdbonly</DebugType> | |||
| <Optimize>true</Optimize> | |||
| <OutputPath>bin\Release\</OutputPath> | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="PresentationCore" /> | |||
| <Reference Include="PresentationFramework" /> | |||
| <Reference Include="System" /> | |||
| <Reference Include="System.Core" /> | |||
| <Reference Include="System.Drawing" /> | |||
| <Reference Include="System.Windows" /> | |||
| <Reference Include="System.Windows.Forms" /> | |||
| <Reference Include="System.Xaml" /> | |||
| <Reference Include="System.Xml.Linq" /> | |||
| <Reference Include="System.Data.DataSetExtensions" /> | |||
| <Reference Include="Microsoft.CSharp" /> | |||
| <Reference Include="System.Data" /> | |||
| <Reference Include="System.Xml" /> | |||
| <Reference Include="WindowsBase" /> | |||
| <Reference Include="WinFormControl, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Compile Include="Dialogs\CalendarSelecter.xaml.cs"> | |||
| <DependentUpon>CalendarSelecter.xaml</DependentUpon> | |||
| </Compile> | |||
| <Compile Include="PickOutConfirm_\PickOutConfirm.cs"> | |||
| <SubType>Form</SubType> | |||
| </Compile> | |||
| <Compile Include="PickOutConfirm_\PickOutConfirm.Designer.cs"> | |||
| <DependentUpon>PickOutConfirm.cs</DependentUpon> | |||
| </Compile> | |||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <EmbeddedResource Include="PickOutConfirm_\PickOutConfirm.resx"> | |||
| <DependentUpon>PickOutConfirm.cs</DependentUpon> | |||
| </EmbeddedResource> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ProjectReference Include="..\ButcherManage.BO\ButcherManage.BO.csproj"> | |||
| <Project>{b1ecbe2f-06fb-4e4c-9487-1497e0808c04}</Project> | |||
| <Name>ButcherManage.BO</Name> | |||
| </ProjectReference> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Page Include="Dialogs\CalendarSelecter.xaml"> | |||
| <SubType>Designer</SubType> | |||
| <Generator>MSBuild:Compile</Generator> | |||
| </Page> | |||
| </ItemGroup> | |||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
| <PropertyGroup> | |||
| <PostBuildEvent>if $(Configuration)==Debug ( | |||
| xcopy "$(ProjectDir)bin\debug\*.*" "$(ProjectDir)..\ButcherManage.Login\bin\debug\" /y | |||
| )</PostBuildEvent> | |||
| </PropertyGroup> | |||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||
| Other similar extension points exist, see Microsoft.Common.targets. | |||
| <Target Name="BeforeBuild"> | |||
| </Target> | |||
| <Target Name="AfterBuild"> | |||
| </Target> | |||
| --> | |||
| </Project> | |||
| @ -0,0 +1,730 @@ | |||
| <Window x:Class="ButcherManage.Dialogs.CalendarSelecter" | |||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
| WindowStartupLocation="CenterOwner" | |||
| Title="MainWindow" | |||
| Width="500" | |||
| Height="500" | |||
| WindowStyle="None" Background="{x:Null}" | |||
| AllowsTransparency="True" | |||
| MouseLeftButtonDown="DragWindow" | |||
| > | |||
| <Window.Resources> | |||
| <Style x:Key="CalendarStyle1" | |||
| TargetType="{x:Type Calendar}"> | |||
| <!--日历控件的背景色,也可以改成绑定的--> | |||
| <Setter Property="Background" | |||
| Value="#f6f6f6" /> | |||
| <Setter Property="Template"> | |||
| <Setter.Value> | |||
| <ControlTemplate TargetType="{x:Type Calendar}"> | |||
| <StackPanel x:Name="PART_Root" | |||
| HorizontalAlignment="Center" | |||
| VerticalAlignment="Center"> | |||
| <!--这个是日历控件的主体元件,也是内部元件PART_CalendarItem名称不要更改,可以改它的其它样式属性--> | |||
| <CalendarItem x:Name="PART_CalendarItem" | |||
| BorderBrush="{TemplateBinding BorderBrush}" | |||
| BorderThickness="{TemplateBinding BorderThickness}" | |||
| Background="{TemplateBinding Background}" | |||
| Style="{TemplateBinding CalendarItemStyle}" | |||
| Height="{TemplateBinding Height}" | |||
| Width="{TemplateBinding Width}" | |||
| HorizontalAlignment="Stretch" | |||
| VerticalAlignment="Stretch" /> | |||
| </StackPanel> | |||
| </ControlTemplate> | |||
| </Setter.Value> | |||
| </Setter> | |||
| </Style> | |||
| <!--日历主体样式表--> | |||
| <Style x:Key="CalendarItemStyle1" | |||
| TargetType="{x:Type CalendarItem}"> | |||
| <Setter Property="Template"> | |||
| <Setter.Value> | |||
| <ControlTemplate TargetType="{x:Type CalendarItem}"> | |||
| <ControlTemplate.Resources> | |||
| <DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}"> | |||
| <!--日历星期几的绑定样式,我格式化成周一,周二等--> | |||
| <TextBlock Foreground="#666666" | |||
| FontSize="16" | |||
| FontFamily="微软雅黑" | |||
| HorizontalAlignment="Center" | |||
| Margin="0 15" | |||
| Text="{Binding StringFormat=周{0} }" | |||
| VerticalAlignment="Center" /> | |||
| </DataTemplate> | |||
| </ControlTemplate.Resources> | |||
| <Grid x:Name="PART_Root"> | |||
| <Grid.Resources> | |||
| <!--设置日历控件 IsEnable=false 时的不可用遮罩层颜色,并且会播放过渡动画--> | |||
| <SolidColorBrush x:Key="DisabledColor" | |||
| Color="#A5FFFFFF" /> | |||
| </Grid.Resources> | |||
| <VisualStateManager.VisualStateGroups> | |||
| <VisualStateGroup x:Name="CommonStates"> | |||
| <VisualState x:Name="Normal" /> | |||
| <VisualState x:Name="Disabled"> | |||
| <!--设置日历控件 IsEnable=false 时遮罩层透明度0-1变色动画--> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To="1" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="PART_DisabledVisual" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| </VisualStateManager.VisualStateGroups> | |||
| <Border BorderBrush="#cfcfcf" | |||
| BorderThickness="0" | |||
| Background="{TemplateBinding Background}" | |||
| CornerRadius="2"> | |||
| <Border> | |||
| <Grid> | |||
| <Grid.Resources> | |||
| <!--日历头左箭头按钮样式模版--> | |||
| <ControlTemplate x:Key="PreviousButtonTemplate" | |||
| TargetType="{x:Type Button}"> | |||
| <!--鼠标悬停在左箭头按钮上时改变鼠标指针样式--> | |||
| <Grid Cursor="Hand"> | |||
| <VisualStateManager.VisualStateGroups> | |||
| <VisualStateGroup x:Name="CommonStates"> | |||
| <VisualState x:Name="Normal" /> | |||
| <VisualState x:Name="MouseOver"> | |||
| <!--鼠标悬停在左箭头按钮上时左箭头颜色变化动画--> | |||
| <Storyboard> | |||
| <ColorAnimation Duration="0" | |||
| To="#FF73A9D8" | |||
| Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" | |||
| Storyboard.TargetName="path" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| <VisualState x:Name="Disabled"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To=".5" | |||
| Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)" | |||
| Storyboard.TargetName="path" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| </VisualStateManager.VisualStateGroups> | |||
| <!--左箭头整个区域矩形块--> | |||
| <Rectangle Fill="#363636" | |||
| Opacity="1" | |||
| Stretch="Fill" /> | |||
| <Grid> | |||
| <!--左箭头--> | |||
| <Path x:Name="path" | |||
| Data="M288.75,232.25 L288.75,240.625 L283,236.625 z" | |||
| Fill="#e0e0e0" | |||
| HorizontalAlignment="Left" | |||
| Height="15" | |||
| Width="15" | |||
| Margin="20,0,0,0" | |||
| Stretch="Fill" | |||
| VerticalAlignment="Center" /> | |||
| </Grid> | |||
| </Grid> | |||
| </ControlTemplate> | |||
| <!--日历头右箭头按钮样式模版,这块跟左箭头样式模版没什么区别--> | |||
| <ControlTemplate x:Key="NextButtonTemplate" | |||
| TargetType="{x:Type Button}"> | |||
| <Grid Cursor="Hand"> | |||
| <VisualStateManager.VisualStateGroups> | |||
| <VisualStateGroup x:Name="CommonStates"> | |||
| <VisualState x:Name="Normal" /> | |||
| <VisualState x:Name="MouseOver"> | |||
| <Storyboard> | |||
| <ColorAnimation Duration="0" | |||
| To="#FF73A9D8" | |||
| Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" | |||
| Storyboard.TargetName="path" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| <VisualState x:Name="Disabled"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To=".5" | |||
| Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)" | |||
| Storyboard.TargetName="path" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| </VisualStateManager.VisualStateGroups> | |||
| <Rectangle Fill="#363636" | |||
| Opacity="1" | |||
| Stretch="Fill" /> | |||
| <Grid> | |||
| <Path x:Name="path" | |||
| Data="M282.875,231.875 L282.875,240.375 L288.625,236 z" | |||
| Fill="#e0e0e0" | |||
| HorizontalAlignment="Right" | |||
| Height="15" | |||
| Width="15" | |||
| Margin="0,0,20,0" | |||
| Stretch="Fill" | |||
| VerticalAlignment="Center" /> | |||
| </Grid> | |||
| </Grid> | |||
| </ControlTemplate> | |||
| <!--日历头中间年按钮样式模版--> | |||
| <ControlTemplate x:Key="HeaderButtonTemplate" | |||
| TargetType="{x:Type Button}"> | |||
| <Grid Cursor="Hand"> | |||
| <VisualStateManager.VisualStateGroups> | |||
| <VisualStateGroup x:Name="CommonStates"> | |||
| <VisualState x:Name="Normal" /> | |||
| <VisualState x:Name="MouseOver"> | |||
| <Storyboard> | |||
| <ColorAnimation Duration="0" | |||
| To="#FF73A9D8" | |||
| Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" | |||
| Storyboard.TargetName="buttonContent" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| <VisualState x:Name="Disabled"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To=".5" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="buttonContent" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| </VisualStateManager.VisualStateGroups> | |||
| <ContentPresenter x:Name="buttonContent" | |||
| ContentTemplate="{TemplateBinding ContentTemplate}" | |||
| Content="{TemplateBinding Content}" | |||
| TextElement.Foreground="#e0e0e0" | |||
| HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
| Margin="1,4,1,9" | |||
| VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
| </Grid> | |||
| </ControlTemplate> | |||
| </Grid.Resources> | |||
| <Grid.RowDefinitions> | |||
| <!--日历头,左箭头,年,右箭头--> | |||
| <RowDefinition Height="Auto" /> | |||
| <!--日历内容,星期几和具体的日期几号几号--> | |||
| <RowDefinition Height="*" /> | |||
| </Grid.RowDefinitions> | |||
| <Grid.ColumnDefinitions> | |||
| <!--左箭头--> | |||
| <ColumnDefinition Width="Auto" /> | |||
| <!--年--> | |||
| <ColumnDefinition Width="*" /> | |||
| <!--右箭头--> | |||
| <ColumnDefinition Width="Auto" /> | |||
| </Grid.ColumnDefinitions> | |||
| <!--头,左箭头,年,右箭头,整体的背景色--> | |||
| <Border Grid.Row="0" | |||
| Grid.ColumnSpan="3" | |||
| Background="#363636"></Border> | |||
| <!--左箭头--> | |||
| <Button x:Name="PART_PreviousButton" | |||
| Grid.Column="0" | |||
| Focusable="False" | |||
| HorizontalAlignment="Left" | |||
| Grid.Row="0" | |||
| Template="{StaticResource PreviousButtonTemplate}" /> | |||
| <!--年--> | |||
| <Button x:Name="PART_HeaderButton" | |||
| Grid.Column="1" | |||
| FontFamily="微软雅黑" | |||
| Focusable="False" | |||
| FontSize="26" | |||
| HorizontalAlignment="Center" | |||
| Grid.Row="0" | |||
| Template="{StaticResource HeaderButtonTemplate}" | |||
| VerticalAlignment="Center" /> | |||
| <!--右箭头--> | |||
| <Button x:Name="PART_NextButton" | |||
| Grid.Column="2" | |||
| Focusable="False" | |||
| HorizontalAlignment="Right" | |||
| Grid.Row="0" | |||
| Template="{StaticResource NextButtonTemplate}" /> | |||
| <!--日期几号几号内容显示--> | |||
| <Border Grid.Row="1" | |||
| Grid.ColumnSpan="3" | |||
| Margin="0" | |||
| BorderBrush="#cfcfcf" | |||
| BorderThickness="3,0,3,3"> | |||
| <Grid x:Name="PART_MonthView" | |||
| HorizontalAlignment="Center" | |||
| Visibility="Visible"> | |||
| <Grid.ColumnDefinitions> | |||
| <ColumnDefinition Width="*" /> | |||
| <ColumnDefinition Width="*" /> | |||
| <ColumnDefinition Width="*" /> | |||
| <ColumnDefinition Width="*" /> | |||
| <ColumnDefinition Width="*" /> | |||
| <ColumnDefinition Width="*" /> | |||
| <ColumnDefinition Width="*" /> | |||
| </Grid.ColumnDefinitions> | |||
| <Grid.RowDefinitions> | |||
| <RowDefinition Height="auto" /> | |||
| <RowDefinition Height="*" /> | |||
| <RowDefinition Height="*" /> | |||
| <RowDefinition Height="*" /> | |||
| <RowDefinition Height="*" /> | |||
| <RowDefinition Height="*" /> | |||
| <RowDefinition Height="*" /> | |||
| </Grid.RowDefinitions> | |||
| </Grid> | |||
| </Border> | |||
| <!--月和年内容显示--> | |||
| <Grid x:Name="PART_YearView" | |||
| Grid.ColumnSpan="3" | |||
| HorizontalAlignment="Center" | |||
| Margin="6,-3,7,6" | |||
| Grid.Row="1" | |||
| Visibility="Hidden" | |||
| VerticalAlignment="Center"> | |||
| <Grid.ColumnDefinitions> | |||
| <ColumnDefinition Width="*" /> | |||
| <ColumnDefinition Width="*" /> | |||
| <ColumnDefinition Width="*" /> | |||
| <ColumnDefinition Width="*" /> | |||
| </Grid.ColumnDefinitions> | |||
| <Grid.RowDefinitions> | |||
| <RowDefinition Height="*" /> | |||
| <RowDefinition Height="*" /> | |||
| <RowDefinition Height="*" /> | |||
| </Grid.RowDefinitions> | |||
| </Grid> | |||
| </Grid> | |||
| </Border> | |||
| </Border> | |||
| <!--日历不可用的遮罩层--> | |||
| <Rectangle x:Name="PART_DisabledVisual" | |||
| Fill="{StaticResource DisabledColor}" | |||
| Opacity="0" | |||
| RadiusY="2" | |||
| RadiusX="2" | |||
| Stretch="Fill" | |||
| Stroke="{StaticResource DisabledColor}" | |||
| StrokeThickness="1" | |||
| Visibility="Collapsed" /> | |||
| </Grid> | |||
| <!--触发器属性--> | |||
| <ControlTemplate.Triggers> | |||
| <Trigger Property="IsEnabled" | |||
| Value="False"> | |||
| <Setter Property="Visibility" | |||
| TargetName="PART_DisabledVisual" | |||
| Value="Visible" /> | |||
| </Trigger> | |||
| <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" | |||
| Value="Year"> | |||
| <Setter Property="Visibility" | |||
| TargetName="PART_MonthView" | |||
| Value="Hidden" /> | |||
| <Setter Property="Visibility" | |||
| TargetName="PART_YearView" | |||
| Value="Visible" /> | |||
| </DataTrigger> | |||
| <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" | |||
| Value="Decade"> | |||
| <Setter Property="Visibility" | |||
| TargetName="PART_MonthView" | |||
| Value="Hidden" /> | |||
| <Setter Property="Visibility" | |||
| TargetName="PART_YearView" | |||
| Value="Visible" /> | |||
| </DataTrigger> | |||
| </ControlTemplate.Triggers> | |||
| </ControlTemplate> | |||
| </Setter.Value> | |||
| </Setter> | |||
| </Style> | |||
| <!--单个几号几号按钮的样式模版--> | |||
| <Style x:Key="CalendarDayButtonStyle1" | |||
| TargetType="{x:Type CalendarDayButton}" > | |||
| <Setter Property="Margin" | |||
| Value="1" /> | |||
| <Setter Property="MinWidth" | |||
| Value="5" /> | |||
| <Setter Property="MinHeight" | |||
| Value="5" /> | |||
| <Setter Property="FontSize" | |||
| Value="22" /> | |||
| <Setter Property="FontFamily" | |||
| Value="微软雅黑" /> | |||
| <Setter Property="HorizontalContentAlignment" | |||
| Value="Center" /> | |||
| <Setter Property="VerticalContentAlignment" | |||
| Value="Center" /> | |||
| <Setter Property="Template"> | |||
| <Setter.Value> | |||
| <ControlTemplate TargetType="{x:Type CalendarDayButton}"> | |||
| <Grid> | |||
| <VisualStateManager.VisualStateGroups> | |||
| <VisualStateGroup x:Name="CommonStates"> | |||
| <VisualStateGroup.Transitions> | |||
| <VisualTransition GeneratedDuration="0:0:0.1" /> | |||
| </VisualStateGroup.Transitions> | |||
| <VisualState x:Name="Normal" /> | |||
| <!--悬停的颜色动画--> | |||
| <VisualState x:Name="MouseOver"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To="0.5" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="HighlightBackground" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| <!--按下后动画--> | |||
| <VisualState x:Name="Pressed"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To="0.5" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="HighlightBackground" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| <!--不可用动画--> | |||
| <VisualState x:Name="Disabled"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To="0" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="HighlightBackground" /> | |||
| <DoubleAnimation Duration="0" | |||
| To=".35" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="NormalText" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| <VisualStateGroup x:Name="SelectionStates"> | |||
| <VisualStateGroup.Transitions> | |||
| <VisualTransition GeneratedDuration="0" /> | |||
| </VisualStateGroup.Transitions> | |||
| <VisualState x:Name="Unselected" /> | |||
| <!--选中某日期的样式--> | |||
| <VisualState x:Name="Selected"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To=".75" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="SelectedBackground" /> | |||
| <ColorAnimation Duration="0" | |||
| To="white" | |||
| Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" | |||
| Storyboard.TargetName="NormalText" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| <VisualStateGroup x:Name="CalendarButtonFocusStates"> | |||
| <VisualStateGroup.Transitions> | |||
| <VisualTransition GeneratedDuration="0" /> | |||
| </VisualStateGroup.Transitions> | |||
| <VisualState x:Name="CalendarButtonFocused"> | |||
| <Storyboard> | |||
| <ObjectAnimationUsingKeyFrames Duration="0" | |||
| Storyboard.TargetProperty="Visibility" | |||
| Storyboard.TargetName="DayButtonFocusVisual"> | |||
| <DiscreteObjectKeyFrame KeyTime="0"> | |||
| <DiscreteObjectKeyFrame.Value> | |||
| <Visibility>Visible</Visibility> | |||
| </DiscreteObjectKeyFrame.Value> | |||
| </DiscreteObjectKeyFrame> | |||
| </ObjectAnimationUsingKeyFrames> | |||
| </Storyboard> | |||
| </VisualState> | |||
| <VisualState x:Name="CalendarButtonUnfocused"> | |||
| <Storyboard> | |||
| <ObjectAnimationUsingKeyFrames Duration="0" | |||
| Storyboard.TargetProperty="Visibility" | |||
| Storyboard.TargetName="DayButtonFocusVisual"> | |||
| <DiscreteObjectKeyFrame KeyTime="0"> | |||
| <DiscreteObjectKeyFrame.Value> | |||
| <Visibility>Collapsed</Visibility> | |||
| </DiscreteObjectKeyFrame.Value> | |||
| </DiscreteObjectKeyFrame> | |||
| </ObjectAnimationUsingKeyFrames> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| <VisualStateGroup x:Name="ActiveStates"> | |||
| <VisualStateGroup.Transitions> | |||
| <VisualTransition GeneratedDuration="0" /> | |||
| </VisualStateGroup.Transitions> | |||
| <VisualState x:Name="Active" /> | |||
| <VisualState x:Name="Inactive"> | |||
| <Storyboard> | |||
| <ColorAnimation Duration="0" | |||
| To="#b4b3b3" | |||
| Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" | |||
| Storyboard.TargetName="NormalText" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| <VisualStateGroup x:Name="DayStates"> | |||
| <VisualStateGroup.Transitions> | |||
| <VisualTransition GeneratedDuration="0" /> | |||
| </VisualStateGroup.Transitions> | |||
| <VisualState x:Name="RegularDay" /> | |||
| <!--今天的样式--> | |||
| <VisualState x:Name="Today"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To="1" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="TodayBackground" /> | |||
| <ColorAnimation Duration="0" | |||
| To="#666666" | |||
| Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" | |||
| Storyboard.TargetName="NormalText" /> | |||
| <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" | |||
| Storyboard.TargetName="imgToday"> | |||
| <DiscreteObjectKeyFrame KeyTime="0"> | |||
| <DiscreteObjectKeyFrame.Value> | |||
| <Visibility>Visible</Visibility> | |||
| </DiscreteObjectKeyFrame.Value> | |||
| </DiscreteObjectKeyFrame> | |||
| </ObjectAnimationUsingKeyFrames> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| <!--过期日期的--> | |||
| <VisualStateGroup x:Name="BlackoutDayStates"> | |||
| <VisualStateGroup.Transitions> | |||
| <VisualTransition GeneratedDuration="0" /> | |||
| </VisualStateGroup.Transitions> | |||
| <VisualState x:Name="NormalDay" /> | |||
| <VisualState x:Name="BlackoutDay"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To=".2" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="Blackout" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| </VisualStateManager.VisualStateGroups> | |||
| <Border BorderBrush="#bbbbbb" | |||
| BorderThickness="1"> | |||
| <Border BorderBrush="white" | |||
| BorderThickness="2,2,0,0" | |||
| Margin="1,1,0,0"></Border> | |||
| </Border> | |||
| <Rectangle x:Name="TodayBackground" | |||
| Fill="#c6c6c6" | |||
| Opacity="0" | |||
| RadiusY="1" | |||
| RadiusX="1" /> | |||
| <Rectangle x:Name="SelectedBackground" | |||
| Fill="#6eafbf" | |||
| Opacity="0" | |||
| RadiusY="1" | |||
| RadiusX="1" /> | |||
| <Border BorderBrush="{TemplateBinding BorderBrush}" | |||
| BorderThickness="{TemplateBinding BorderThickness}" | |||
| Background="{TemplateBinding Background}" /> | |||
| <Rectangle x:Name="HighlightBackground" | |||
| Fill="#FFBADDE9" | |||
| Opacity="0" | |||
| RadiusY="1" | |||
| RadiusX="1" /> | |||
| <ContentPresenter x:Name="NormalText" | |||
| TextElement.Foreground="#666666" | |||
| HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
| VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
| <Path x:Name="Blackout" | |||
| Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z" | |||
| Fill="#FF000000" | |||
| HorizontalAlignment="Stretch" | |||
| Margin="3" | |||
| Opacity="0" | |||
| RenderTransformOrigin="0.5,0.5" | |||
| Stretch="Fill" | |||
| VerticalAlignment="Stretch" /> | |||
| <Rectangle x:Name="DayButtonFocusVisual" | |||
| IsHitTestVisible="false" | |||
| RadiusY="1" | |||
| RadiusX="1" | |||
| Stroke="#FF45D6FA" | |||
| Visibility="Collapsed" /> | |||
| <Image x:Name="imgToday" | |||
| Width="44" | |||
| Height="34" | |||
| VerticalAlignment="Top" | |||
| HorizontalAlignment="Left" | |||
| Initialized="imgToday_Initialized" | |||
| Visibility="Hidden" /> | |||
| </Grid> | |||
| </ControlTemplate> | |||
| </Setter.Value> | |||
| </Setter> | |||
| </Style> | |||
| <Style x:Key="CalendarButtonStyle1" | |||
| TargetType="{x:Type CalendarButton}" > | |||
| <Setter Property="Background" | |||
| Value="#FFBADDE9" /> | |||
| <Setter Property="MinWidth" | |||
| Value="80" /> | |||
| <Setter Property="MinHeight" | |||
| Value="80" /> | |||
| <Setter Property="Margin" | |||
| Value="20" /> | |||
| <Setter Property="FontSize" | |||
| Value="25" /> | |||
| <Setter Property="HorizontalContentAlignment" | |||
| Value="Center" /> | |||
| <Setter Property="VerticalContentAlignment" | |||
| Value="Center" /> | |||
| <Setter Property="Template"> | |||
| <Setter.Value> | |||
| <ControlTemplate TargetType="{x:Type CalendarButton}"> | |||
| <Grid> | |||
| <VisualStateManager.VisualStateGroups> | |||
| <VisualStateGroup x:Name="CommonStates"> | |||
| <VisualStateGroup.Transitions> | |||
| <VisualTransition GeneratedDuration="0:0:0.1" /> | |||
| </VisualStateGroup.Transitions> | |||
| <VisualState x:Name="Normal" /> | |||
| <VisualState x:Name="MouseOver"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To=".5" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="Background" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| <VisualState x:Name="Pressed"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To=".5" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="Background" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| <VisualStateGroup x:Name="SelectionStates"> | |||
| <VisualStateGroup.Transitions> | |||
| <VisualTransition GeneratedDuration="0" /> | |||
| </VisualStateGroup.Transitions> | |||
| <VisualState x:Name="Unselected" /> | |||
| <VisualState x:Name="Selected"> | |||
| <Storyboard> | |||
| <DoubleAnimation Duration="0" | |||
| To=".75" | |||
| Storyboard.TargetProperty="Opacity" | |||
| Storyboard.TargetName="SelectedBackground" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| <VisualStateGroup x:Name="ActiveStates"> | |||
| <VisualStateGroup.Transitions> | |||
| <VisualTransition GeneratedDuration="0" /> | |||
| </VisualStateGroup.Transitions> | |||
| <VisualState x:Name="Active" /> | |||
| <VisualState x:Name="Inactive"> | |||
| <Storyboard> | |||
| <ColorAnimation Duration="0" | |||
| To="#FF777777" | |||
| Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" | |||
| Storyboard.TargetName="NormalText" /> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| <VisualStateGroup x:Name="CalendarButtonFocusStates"> | |||
| <VisualStateGroup.Transitions> | |||
| <VisualTransition GeneratedDuration="0" /> | |||
| </VisualStateGroup.Transitions> | |||
| <VisualState x:Name="CalendarButtonFocused"> | |||
| <Storyboard> | |||
| <ObjectAnimationUsingKeyFrames Duration="0" | |||
| Storyboard.TargetProperty="Visibility" | |||
| Storyboard.TargetName="CalendarButtonFocusVisual"> | |||
| <DiscreteObjectKeyFrame KeyTime="0"> | |||
| <DiscreteObjectKeyFrame.Value> | |||
| <Visibility>Visible</Visibility> | |||
| </DiscreteObjectKeyFrame.Value> | |||
| </DiscreteObjectKeyFrame> | |||
| </ObjectAnimationUsingKeyFrames> | |||
| </Storyboard> | |||
| </VisualState> | |||
| <VisualState x:Name="CalendarButtonUnfocused"> | |||
| <Storyboard> | |||
| <ObjectAnimationUsingKeyFrames Duration="0" | |||
| Storyboard.TargetProperty="Visibility" | |||
| Storyboard.TargetName="CalendarButtonFocusVisual"> | |||
| <DiscreteObjectKeyFrame KeyTime="0"> | |||
| <DiscreteObjectKeyFrame.Value> | |||
| <Visibility>Collapsed</Visibility> | |||
| </DiscreteObjectKeyFrame.Value> | |||
| </DiscreteObjectKeyFrame> | |||
| </ObjectAnimationUsingKeyFrames> | |||
| </Storyboard> | |||
| </VisualState> | |||
| </VisualStateGroup> | |||
| </VisualStateManager.VisualStateGroups> | |||
| <Rectangle x:Name="SelectedBackground" | |||
| Fill="{TemplateBinding Background}" | |||
| Opacity="0" | |||
| RadiusY="1" | |||
| RadiusX="1" /> | |||
| <Rectangle x:Name="Background" | |||
| Fill="{TemplateBinding Background}" | |||
| Opacity="0" | |||
| RadiusY="1" | |||
| RadiusX="1" /> | |||
| <ContentPresenter x:Name="NormalText" | |||
| TextElement.Foreground="#FF333333" | |||
| HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
| Margin="1,0,1,1" | |||
| VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
| <Rectangle x:Name="CalendarButtonFocusVisual" | |||
| IsHitTestVisible="false" | |||
| RadiusY="1" | |||
| RadiusX="1" | |||
| Stroke="#FF45D6FA" | |||
| Visibility="Collapsed" /> | |||
| </Grid> | |||
| <ControlTemplate.Triggers> | |||
| <Trigger Property="IsFocused" | |||
| Value="True"> | |||
| <Setter Property="Visibility" | |||
| TargetName="CalendarButtonFocusVisual" | |||
| Value="Visible" /> | |||
| </Trigger> | |||
| </ControlTemplate.Triggers> | |||
| </ControlTemplate> | |||
| </Setter.Value> | |||
| </Setter> | |||
| </Style> | |||
| </Window.Resources> | |||
| <Grid x:Name="LayoutRoot"> | |||
| <Calendar x:Name="MC" Style="{DynamicResource CalendarStyle1}" | |||
| CalendarItemStyle="{DynamicResource CalendarItemStyle1}" | |||
| CalendarDayButtonStyle="{DynamicResource CalendarDayButtonStyle1}" | |||
| CalendarButtonStyle="{DynamicResource CalendarButtonStyle1}" | |||
| SelectedDatesChanged="MC_SelectedDatesChanged" | |||
| Width="500" | |||
| Height="500"> | |||
| </Calendar> | |||
| </Grid> | |||
| </Window> | |||
| @ -0,0 +1,61 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.ComponentModel; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| using System.Windows; | |||
| using System.Windows.Controls; | |||
| using System.Windows.Data; | |||
| using System.Windows.Documents; | |||
| using System.Windows.Input; | |||
| using System.Windows.Media; | |||
| using System.Windows.Media.Imaging; | |||
| using System.Windows.Navigation; | |||
| using System.Windows.Shapes; | |||
| namespace ButcherManage.Dialogs | |||
| { | |||
| /// <summary> | |||
| /// CalendarSelecter.xaml 的交互逻辑 | |||
| /// </summary> | |||
| public partial class CalendarSelecter : Window, INotifyPropertyChanged | |||
| { | |||
| public CalendarSelecter() | |||
| { | |||
| InitializeComponent(); | |||
| } | |||
| public void DragWindow(object sender, MouseButtonEventArgs args) | |||
| { | |||
| this.DragMove(); | |||
| } | |||
| private DateTime _result; | |||
| public DateTime Result | |||
| { | |||
| get { return _result; } | |||
| private set { _result = value; OnPropertyChanged("Result"); } | |||
| } | |||
| private void MC_SelectedDatesChanged(object sender, EventArgs e) | |||
| { | |||
| Result = MC.SelectedDate.Value; | |||
| DialogResult = true; | |||
| } | |||
| public event PropertyChangedEventHandler PropertyChanged; | |||
| protected void OnPropertyChanged(string propertyName) | |||
| { | |||
| if (PropertyChanged != null) | |||
| PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); | |||
| } | |||
| private void imgToday_Initialized(object sender, EventArgs e) | |||
| { | |||
| var imagePanel = (sender as Image); | |||
| var path = System.IO.Path.Combine(Environment.CurrentDirectory, "Images", "today.png"); | |||
| imagePanel.Source = new BitmapImage(new Uri(path, UriKind.Absolute)); ; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,543 @@ | |||
| namespace ButcherManage.PickOutConfirm_ | |||
| { | |||
| partial class PickOutConfirm | |||
| { | |||
| /// <summary> | |||
| /// Required designer variable. | |||
| /// </summary> | |||
| private System.ComponentModel.IContainer components = null; | |||
| /// <summary> | |||
| /// Clean up any resources being used. | |||
| /// </summary> | |||
| /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | |||
| protected override void Dispose(bool disposing) | |||
| { | |||
| if (disposing && (components != null)) | |||
| { | |||
| components.Dispose(); | |||
| } | |||
| base.Dispose(disposing); | |||
| } | |||
| #region Windows Form Designer generated code | |||
| /// <summary> | |||
| /// Required method for Designer support - do not modify | |||
| /// the contents of this method with the code editor. | |||
| /// </summary> | |||
| private void InitializeComponent() | |||
| { | |||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); | |||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); | |||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); | |||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); | |||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); | |||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); | |||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); | |||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); | |||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); | |||
| this.panel1 = new System.Windows.Forms.Panel(); | |||
| this.orderGrid = new WinFormControl.UDataGridView(); | |||
| this.L_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
| this.L_ConfirmState = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
| this.L_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
| this.L_PlanNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
| this.L_LiveColonyHouse_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
| this.L_AlreadyNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
| this.L_Start = new System.Windows.Forms.DataGridViewButtonColumn(); | |||
| this.L_End = new System.Windows.Forms.DataGridViewButtonColumn(); | |||
| this.panel2 = new System.Windows.Forms.Panel(); | |||
| this.zeroBtn = new WinFormControl.NButton(); | |||
| this.panel3 = new System.Windows.Forms.Panel(); | |||
| this.countLbl = new WinFormControl.ULabel(); | |||
| this.uLabel3 = new WinFormControl.ULabel(); | |||
| this.uLabel2 = new WinFormControl.ULabel(); | |||
| this.numberLbl = new WinFormControl.ULabel(); | |||
| this.recordGrid = new WinFormControl.UDataGridView(); | |||
| this.R_C1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
| this.R_C2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
| this.R_C3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
| this.R_C4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
| this.R_C5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
| this.numPad = new System.Windows.Forms.FlowLayoutPanel(); | |||
| this.colseBtn = new WinFormControl.NButton(); | |||
| this.uTimerLabel1 = new WinFormControl.UTimerLabel(); | |||
| this.datePicker = new System.Windows.Forms.TextBox(); | |||
| this.uLabel1 = new WinFormControl.ULabel(); | |||
| this.queryBtn = new WinFormControl.NButton(); | |||
| this.uLabel4 = new WinFormControl.ULabel(); | |||
| this.orderLbl = new WinFormControl.ULabel(); | |||
| this.panel1.SuspendLayout(); | |||
| ((System.ComponentModel.ISupportInitialize)(this.orderGrid)).BeginInit(); | |||
| this.panel2.SuspendLayout(); | |||
| this.panel3.SuspendLayout(); | |||
| ((System.ComponentModel.ISupportInitialize)(this.recordGrid)).BeginInit(); | |||
| this.SuspendLayout(); | |||
| // | |||
| // panel1 | |||
| // | |||
| this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | |||
| | System.Windows.Forms.AnchorStyles.Left) | |||
| | System.Windows.Forms.AnchorStyles.Right))); | |||
| this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; | |||
| this.panel1.Controls.Add(this.orderGrid); | |||
| this.panel1.Location = new System.Drawing.Point(12, 65); | |||
| this.panel1.Name = "panel1"; | |||
| this.panel1.Size = new System.Drawing.Size(559, 503); | |||
| this.panel1.TabIndex = 2; | |||
| // | |||
| // orderGrid | |||
| // | |||
| this.orderGrid.AllowUserToAddRows = false; | |||
| this.orderGrid.AllowUserToDeleteRows = false; | |||
| this.orderGrid.AllowUserToResizeColumns = false; | |||
| this.orderGrid.AllowUserToResizeRows = false; | |||
| dataGridViewCellStyle10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); | |||
| this.orderGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10; | |||
| this.orderGrid.BackgroundColor = System.Drawing.Color.White; | |||
| this.orderGrid.BorderStyle = System.Windows.Forms.BorderStyle.None; | |||
| dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |||
| dataGridViewCellStyle11.Font = new System.Drawing.Font("宋体", 12F); | |||
| dataGridViewCellStyle11.ForeColor = System.Drawing.Color.White; | |||
| dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |||
| this.orderGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; | |||
| this.orderGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; | |||
| this.orderGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { | |||
| this.L_ID, | |||
| this.L_ConfirmState, | |||
| this.L_Order, | |||
| this.L_PlanNumber, | |||
| this.L_LiveColonyHouse_Name, | |||
| this.L_AlreadyNumber, | |||
| this.L_Start, | |||
| this.L_End}); | |||
| this.orderGrid.Dock = System.Windows.Forms.DockStyle.Fill; | |||
| this.orderGrid.Location = new System.Drawing.Point(0, 0); | |||
| this.orderGrid.MultiSelect = false; | |||
| this.orderGrid.Name = "orderGrid"; | |||
| this.orderGrid.ReadOnly = true; | |||
| dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; | |||
| dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; | |||
| dataGridViewCellStyle14.Font = new System.Drawing.Font("宋体", 12F); | |||
| dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; | |||
| dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |||
| dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |||
| dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |||
| this.orderGrid.RowHeadersDefaultCellStyle = dataGridViewCellStyle14; | |||
| this.orderGrid.RowHeadersVisible = false; | |||
| dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 15F); | |||
| dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); | |||
| this.orderGrid.RowsDefaultCellStyle = dataGridViewCellStyle15; | |||
| this.orderGrid.RowTemplate.Height = 80; | |||
| this.orderGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; | |||
| this.orderGrid.Size = new System.Drawing.Size(557, 501); | |||
| this.orderGrid.TabIndex = 2; | |||
| this.orderGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.orderGrid_CellClick); | |||
| this.orderGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.orderGrid_CellContentClick); | |||
| this.orderGrid.RowPrePaint += new System.Windows.Forms.DataGridViewRowPrePaintEventHandler(this.orderGrid_RowPrePaint); | |||
| // | |||
| // L_ID | |||
| // | |||
| this.L_ID.DataPropertyName = "ID"; | |||
| this.L_ID.HeaderText = "ID"; | |||
| this.L_ID.Name = "L_ID"; | |||
| this.L_ID.ReadOnly = true; | |||
| this.L_ID.Visible = false; | |||
| // | |||
| // L_ConfirmState | |||
| // | |||
| this.L_ConfirmState.DataPropertyName = "ConfirmState"; | |||
| this.L_ConfirmState.HeaderText = "ConfirmState"; | |||
| this.L_ConfirmState.Name = "L_ConfirmState"; | |||
| this.L_ConfirmState.ReadOnly = true; | |||
| this.L_ConfirmState.Visible = false; | |||
| // | |||
| // L_Order | |||
| // | |||
| this.L_Order.DataPropertyName = "Order"; | |||
| this.L_Order.HeaderText = "顺序"; | |||
| this.L_Order.Name = "L_Order"; | |||
| this.L_Order.ReadOnly = true; | |||
| // | |||
| // L_PlanNumber | |||
| // | |||
| this.L_PlanNumber.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; | |||
| this.L_PlanNumber.DataPropertyName = "PlanNumber"; | |||
| this.L_PlanNumber.HeaderText = "排宰头数"; | |||
| this.L_PlanNumber.Name = "L_PlanNumber"; | |||
| this.L_PlanNumber.ReadOnly = true; | |||
| // | |||
| // L_LiveColonyHouse_Name | |||
| // | |||
| this.L_LiveColonyHouse_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; | |||
| this.L_LiveColonyHouse_Name.DataPropertyName = "LiveColonyHouse_Name"; | |||
| this.L_LiveColonyHouse_Name.HeaderText = "圈舍"; | |||
| this.L_LiveColonyHouse_Name.MinimumWidth = 200; | |||
| this.L_LiveColonyHouse_Name.Name = "L_LiveColonyHouse_Name"; | |||
| this.L_LiveColonyHouse_Name.ReadOnly = true; | |||
| // | |||
| // L_AlreadyNumber | |||
| // | |||
| this.L_AlreadyNumber.DataPropertyName = "AlreadyNumber"; | |||
| this.L_AlreadyNumber.HeaderText = "确认头数"; | |||
| this.L_AlreadyNumber.Name = "L_AlreadyNumber"; | |||
| this.L_AlreadyNumber.ReadOnly = true; | |||
| // | |||
| // L_Start | |||
| // | |||
| dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |||
| dataGridViewCellStyle12.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); | |||
| this.L_Start.DefaultCellStyle = dataGridViewCellStyle12; | |||
| this.L_Start.HeaderText = "开始"; | |||
| this.L_Start.Name = "L_Start"; | |||
| this.L_Start.ReadOnly = true; | |||
| this.L_Start.Text = "开始"; | |||
| this.L_Start.UseColumnTextForButtonValue = true; | |||
| this.L_Start.Width = 140; | |||
| // | |||
| // L_End | |||
| // | |||
| dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |||
| dataGridViewCellStyle13.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); | |||
| this.L_End.DefaultCellStyle = dataGridViewCellStyle13; | |||
| this.L_End.HeaderText = "结束"; | |||
| this.L_End.Name = "L_End"; | |||
| this.L_End.ReadOnly = true; | |||
| this.L_End.Text = "结束"; | |||
| this.L_End.UseColumnTextForButtonValue = true; | |||
| this.L_End.Width = 140; | |||
| // | |||
| // panel2 | |||
| // | |||
| this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | |||
| | System.Windows.Forms.AnchorStyles.Right))); | |||
| this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; | |||
| this.panel2.Controls.Add(this.zeroBtn); | |||
| this.panel2.Controls.Add(this.panel3); | |||
| this.panel2.Controls.Add(this.recordGrid); | |||
| this.panel2.Controls.Add(this.numPad); | |||
| this.panel2.Location = new System.Drawing.Point(589, 65); | |||
| this.panel2.Name = "panel2"; | |||
| this.panel2.Size = new System.Drawing.Size(421, 503); | |||
| this.panel2.TabIndex = 3; | |||
| // | |||
| // zeroBtn | |||
| // | |||
| this.zeroBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); | |||
| this.zeroBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(136)))), ((int)(((byte)(255))))); | |||
| this.zeroBtn.ClickColor = System.Drawing.Color.YellowGreen; | |||
| this.zeroBtn.Font = new System.Drawing.Font("宋体", 15F); | |||
| this.zeroBtn.ForeColor = System.Drawing.Color.White; | |||
| this.zeroBtn.Location = new System.Drawing.Point(17, 157); | |||
| this.zeroBtn.Name = "zeroBtn"; | |||
| this.zeroBtn.PlaySound = true; | |||
| this.zeroBtn.Size = new System.Drawing.Size(100, 60); | |||
| this.zeroBtn.SoundType = WinFormControl.SoundType.Click; | |||
| this.zeroBtn.TabIndex = 7; | |||
| this.zeroBtn.Text = "0"; | |||
| this.zeroBtn.ToColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(136)))), ((int)(((byte)(255))))); | |||
| this.zeroBtn.UseVisualStyleBackColor = false; | |||
| this.zeroBtn.Click += new System.EventHandler(this.NumberBtnClick); | |||
| // | |||
| // panel3 | |||
| // | |||
| this.panel3.Anchor = System.Windows.Forms.AnchorStyles.Bottom; | |||
| this.panel3.Controls.Add(this.countLbl); | |||
| this.panel3.Controls.Add(this.uLabel3); | |||
| this.panel3.Controls.Add(this.uLabel2); | |||
| this.panel3.Controls.Add(this.numberLbl); | |||
| this.panel3.Location = new System.Drawing.Point(157, 158); | |||
| this.panel3.Name = "panel3"; | |||
| this.panel3.Size = new System.Drawing.Size(239, 38); | |||
| this.panel3.TabIndex = 6; | |||
| // | |||
| // countLbl | |||
| // | |||
| this.countLbl.AutoSize = true; | |||
| this.countLbl.BackColor = System.Drawing.Color.Transparent; | |||
| this.countLbl.Font = new System.Drawing.Font("宋体", 15F); | |||
| this.countLbl.ForeColor = System.Drawing.Color.Red; | |||
| this.countLbl.Location = new System.Drawing.Point(14, 9); | |||
| this.countLbl.Name = "countLbl"; | |||
| this.countLbl.Size = new System.Drawing.Size(19, 20); | |||
| this.countLbl.TabIndex = 2; | |||
| this.countLbl.Text = "0"; | |||
| // | |||
| // uLabel3 | |||
| // | |||
| this.uLabel3.AutoSize = true; | |||
| this.uLabel3.BackColor = System.Drawing.Color.Transparent; | |||
| this.uLabel3.Font = new System.Drawing.Font("宋体", 15F); | |||
| this.uLabel3.ForeColor = System.Drawing.Color.Red; | |||
| this.uLabel3.Location = new System.Drawing.Point(200, 9); | |||
| this.uLabel3.Name = "uLabel3"; | |||
| this.uLabel3.Size = new System.Drawing.Size(29, 20); | |||
| this.uLabel3.TabIndex = 5; | |||
| this.uLabel3.Text = "头"; | |||
| // | |||
| // uLabel2 | |||
| // | |||
| this.uLabel2.AutoSize = true; | |||
| this.uLabel2.BackColor = System.Drawing.Color.Transparent; | |||
| this.uLabel2.Font = new System.Drawing.Font("宋体", 15F); | |||
| this.uLabel2.ForeColor = System.Drawing.Color.Red; | |||
| this.uLabel2.Location = new System.Drawing.Point(55, 9); | |||
| this.uLabel2.Name = "uLabel2"; | |||
| this.uLabel2.Size = new System.Drawing.Size(29, 20); | |||
| this.uLabel2.TabIndex = 3; | |||
| this.uLabel2.Text = "次"; | |||
| // | |||
| // numberLbl | |||
| // | |||
| this.numberLbl.AutoSize = true; | |||
| this.numberLbl.BackColor = System.Drawing.Color.Transparent; | |||
| this.numberLbl.Font = new System.Drawing.Font("宋体", 15F); | |||
| this.numberLbl.ForeColor = System.Drawing.Color.Red; | |||
| this.numberLbl.Location = new System.Drawing.Point(159, 9); | |||
| this.numberLbl.Name = "numberLbl"; | |||
| this.numberLbl.Size = new System.Drawing.Size(19, 20); | |||
| this.numberLbl.TabIndex = 4; | |||
| this.numberLbl.Text = "0"; | |||
| // | |||
| // recordGrid | |||
| // | |||
| this.recordGrid.AllowUserToAddRows = false; | |||
| this.recordGrid.AllowUserToDeleteRows = false; | |||
| this.recordGrid.AllowUserToResizeColumns = false; | |||
| this.recordGrid.AllowUserToResizeRows = false; | |||
| dataGridViewCellStyle16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); | |||
| this.recordGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle16; | |||
| this.recordGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); | |||
| this.recordGrid.BackgroundColor = System.Drawing.Color.White; | |||
| this.recordGrid.BorderStyle = System.Windows.Forms.BorderStyle.None; | |||
| dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |||
| dataGridViewCellStyle17.Font = new System.Drawing.Font("宋体", 12F); | |||
| dataGridViewCellStyle17.ForeColor = System.Drawing.Color.White; | |||
| dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |||
| this.recordGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle17; | |||
| this.recordGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; | |||
| this.recordGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { | |||
| this.R_C1, | |||
| this.R_C2, | |||
| this.R_C3, | |||
| this.R_C4, | |||
| this.R_C5}); | |||
| this.recordGrid.Location = new System.Drawing.Point(-1, -1); | |||
| this.recordGrid.MultiSelect = false; | |||
| this.recordGrid.Name = "recordGrid"; | |||
| this.recordGrid.ReadOnly = true; | |||
| this.recordGrid.RowHeadersVisible = false; | |||
| dataGridViewCellStyle18.Font = new System.Drawing.Font("宋体", 15F); | |||
| dataGridViewCellStyle18.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); | |||
| this.recordGrid.RowsDefaultCellStyle = dataGridViewCellStyle18; | |||
| this.recordGrid.RowTemplate.Height = 50; | |||
| this.recordGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; | |||
| this.recordGrid.Size = new System.Drawing.Size(421, 153); | |||
| this.recordGrid.TabIndex = 1; | |||
| // | |||
| // R_C1 | |||
| // | |||
| this.R_C1.DataPropertyName = "Number1"; | |||
| this.R_C1.HeaderText = "列1"; | |||
| this.R_C1.Name = "R_C1"; | |||
| this.R_C1.ReadOnly = true; | |||
| this.R_C1.Width = 80; | |||
| // | |||
| // R_C2 | |||
| // | |||
| this.R_C2.DataPropertyName = "Number2"; | |||
| this.R_C2.HeaderText = "列2"; | |||
| this.R_C2.Name = "R_C2"; | |||
| this.R_C2.ReadOnly = true; | |||
| this.R_C2.Width = 80; | |||
| // | |||
| // R_C3 | |||
| // | |||
| this.R_C3.DataPropertyName = "Number3"; | |||
| this.R_C3.HeaderText = "列3"; | |||
| this.R_C3.Name = "R_C3"; | |||
| this.R_C3.ReadOnly = true; | |||
| this.R_C3.Width = 80; | |||
| // | |||
| // R_C4 | |||
| // | |||
| this.R_C4.DataPropertyName = "Number4"; | |||
| this.R_C4.HeaderText = "列4"; | |||
| this.R_C4.Name = "R_C4"; | |||
| this.R_C4.ReadOnly = true; | |||
| this.R_C4.Width = 80; | |||
| // | |||
| // R_C5 | |||
| // | |||
| this.R_C5.DataPropertyName = "Number5"; | |||
| this.R_C5.HeaderText = "列5"; | |||
| this.R_C5.Name = "R_C5"; | |||
| this.R_C5.ReadOnly = true; | |||
| this.R_C5.Width = 80; | |||
| // | |||
| // numPad | |||
| // | |||
| this.numPad.Anchor = System.Windows.Forms.AnchorStyles.Bottom; | |||
| this.numPad.Location = new System.Drawing.Point(-1, 220); | |||
| this.numPad.Name = "numPad"; | |||
| this.numPad.Size = new System.Drawing.Size(421, 278); | |||
| this.numPad.TabIndex = 0; | |||
| // | |||
| // colseBtn | |||
| // | |||
| this.colseBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||
| this.colseBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(136)))), ((int)(((byte)(255))))); | |||
| this.colseBtn.ClickColor = System.Drawing.Color.YellowGreen; | |||
| this.colseBtn.Font = new System.Drawing.Font("宋体", 12F); | |||
| this.colseBtn.ForeColor = System.Drawing.Color.White; | |||
| this.colseBtn.Location = new System.Drawing.Point(897, 9); | |||
| this.colseBtn.Name = "colseBtn"; | |||
| this.colseBtn.PlaySound = false; | |||
| this.colseBtn.Size = new System.Drawing.Size(113, 45); | |||
| this.colseBtn.SoundType = WinFormControl.SoundType.Click; | |||
| this.colseBtn.TabIndex = 4; | |||
| this.colseBtn.Text = "关 闭"; | |||
| this.colseBtn.ToColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(136)))), ((int)(((byte)(255))))); | |||
| this.colseBtn.UseVisualStyleBackColor = false; | |||
| this.colseBtn.Click += new System.EventHandler(this.colseBtn_Click); | |||
| // | |||
| // uTimerLabel1 | |||
| // | |||
| this.uTimerLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||
| this.uTimerLabel1.AutoSize = true; | |||
| this.uTimerLabel1.BackColor = System.Drawing.Color.Transparent; | |||
| this.uTimerLabel1.Font = new System.Drawing.Font("黑体", 13F); | |||
| this.uTimerLabel1.Format = "M月d日 H:mm:ss"; | |||
| this.uTimerLabel1.Location = new System.Drawing.Point(727, 22); | |||
| this.uTimerLabel1.Name = "uTimerLabel1"; | |||
| this.uTimerLabel1.Size = new System.Drawing.Size(152, 18); | |||
| this.uTimerLabel1.TabIndex = 0; | |||
| this.uTimerLabel1.Text = "6月11日 15:37:03"; | |||
| // | |||
| // datePicker | |||
| // | |||
| this.datePicker.Font = new System.Drawing.Font("宋体", 15F); | |||
| this.datePicker.Location = new System.Drawing.Point(121, 24); | |||
| this.datePicker.Name = "datePicker"; | |||
| this.datePicker.ReadOnly = true; | |||
| this.datePicker.Size = new System.Drawing.Size(156, 30); | |||
| this.datePicker.TabIndex = 5; | |||
| this.datePicker.MouseDown += new System.Windows.Forms.MouseEventHandler(this.datePicker_MouseDown); | |||
| // | |||
| // uLabel1 | |||
| // | |||
| this.uLabel1.AutoSize = true; | |||
| this.uLabel1.BackColor = System.Drawing.Color.Transparent; | |||
| this.uLabel1.Font = new System.Drawing.Font("宋体", 15F); | |||
| this.uLabel1.Location = new System.Drawing.Point(12, 29); | |||
| this.uLabel1.Name = "uLabel1"; | |||
| this.uLabel1.Size = new System.Drawing.Size(109, 20); | |||
| this.uLabel1.TabIndex = 6; | |||
| this.uLabel1.Text = "宰杀日期:"; | |||
| // | |||
| // queryBtn | |||
| // | |||
| this.queryBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(136)))), ((int)(((byte)(255))))); | |||
| this.queryBtn.ClickColor = System.Drawing.Color.YellowGreen; | |||
| this.queryBtn.Font = new System.Drawing.Font("宋体", 12F); | |||
| this.queryBtn.ForeColor = System.Drawing.Color.White; | |||
| this.queryBtn.Location = new System.Drawing.Point(283, 14); | |||
| this.queryBtn.Name = "queryBtn"; | |||
| this.queryBtn.PlaySound = false; | |||
| this.queryBtn.Size = new System.Drawing.Size(113, 45); | |||
| this.queryBtn.SoundType = WinFormControl.SoundType.Click; | |||
| this.queryBtn.TabIndex = 7; | |||
| this.queryBtn.Text = "查 询"; | |||
| this.queryBtn.ToColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(136)))), ((int)(((byte)(255))))); | |||
| this.queryBtn.UseVisualStyleBackColor = false; | |||
| this.queryBtn.Click += new System.EventHandler(this.queryBtn_Click); | |||
| // | |||
| // uLabel4 | |||
| // | |||
| this.uLabel4.AutoSize = true; | |||
| this.uLabel4.BackColor = System.Drawing.Color.Transparent; | |||
| this.uLabel4.Font = new System.Drawing.Font("宋体", 15F); | |||
| this.uLabel4.ForeColor = System.Drawing.SystemColors.ControlText; | |||
| this.uLabel4.Location = new System.Drawing.Point(413, 27); | |||
| this.uLabel4.Name = "uLabel4"; | |||
| this.uLabel4.Size = new System.Drawing.Size(109, 20); | |||
| this.uLabel4.TabIndex = 8; | |||
| this.uLabel4.Text = "作业顺序:"; | |||
| // | |||
| // orderLbl | |||
| // | |||
| this.orderLbl.AutoSize = true; | |||
| this.orderLbl.BackColor = System.Drawing.Color.Transparent; | |||
| this.orderLbl.Font = new System.Drawing.Font("宋体", 23F); | |||
| this.orderLbl.ForeColor = System.Drawing.Color.Red; | |||
| this.orderLbl.Location = new System.Drawing.Point(516, 19); | |||
| this.orderLbl.Name = "orderLbl"; | |||
| this.orderLbl.Size = new System.Drawing.Size(30, 31); | |||
| this.orderLbl.TabIndex = 9; | |||
| this.orderLbl.Text = "0"; | |||
| // | |||
| // PickOutConfirm | |||
| // | |||
| this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); | |||
| this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||
| this.BackColor = System.Drawing.Color.White; | |||
| this.ClientSize = new System.Drawing.Size(1022, 591); | |||
| this.Controls.Add(this.orderLbl); | |||
| this.Controls.Add(this.uLabel4); | |||
| this.Controls.Add(this.queryBtn); | |||
| this.Controls.Add(this.datePicker); | |||
| this.Controls.Add(this.colseBtn); | |||
| this.Controls.Add(this.panel2); | |||
| this.Controls.Add(this.panel1); | |||
| this.Controls.Add(this.uTimerLabel1); | |||
| this.Controls.Add(this.uLabel1); | |||
| this.Name = "PickOutConfirm"; | |||
| this.Text = "赶猪确认"; | |||
| this.WindowState = System.Windows.Forms.FormWindowState.Maximized; | |||
| this.panel1.ResumeLayout(false); | |||
| ((System.ComponentModel.ISupportInitialize)(this.orderGrid)).EndInit(); | |||
| this.panel2.ResumeLayout(false); | |||
| this.panel3.ResumeLayout(false); | |||
| this.panel3.PerformLayout(); | |||
| ((System.ComponentModel.ISupportInitialize)(this.recordGrid)).EndInit(); | |||
| this.ResumeLayout(false); | |||
| this.PerformLayout(); | |||
| } | |||
| #endregion | |||
| private WinFormControl.UTimerLabel uTimerLabel1; | |||
| private System.Windows.Forms.Panel panel1; | |||
| private System.Windows.Forms.Panel panel2; | |||
| private WinFormControl.NButton colseBtn; | |||
| private System.Windows.Forms.FlowLayoutPanel numPad; | |||
| private WinFormControl.UDataGridView orderGrid; | |||
| private WinFormControl.UDataGridView recordGrid; | |||
| private WinFormControl.ULabel uLabel2; | |||
| private WinFormControl.ULabel countLbl; | |||
| private WinFormControl.ULabel uLabel3; | |||
| private WinFormControl.ULabel numberLbl; | |||
| private System.Windows.Forms.Panel panel3; | |||
| private WinFormControl.NButton zeroBtn; | |||
| private System.Windows.Forms.DataGridViewTextBoxColumn R_C1; | |||
| private System.Windows.Forms.DataGridViewTextBoxColumn R_C2; | |||
| private System.Windows.Forms.DataGridViewTextBoxColumn R_C3; | |||
| private System.Windows.Forms.DataGridViewTextBoxColumn R_C4; | |||
| private System.Windows.Forms.DataGridViewTextBoxColumn R_C5; | |||
| private System.Windows.Forms.TextBox datePicker; | |||
| private WinFormControl.ULabel uLabel1; | |||
| private WinFormControl.NButton queryBtn; | |||
| private System.Windows.Forms.DataGridViewTextBoxColumn L_ID; | |||
| private System.Windows.Forms.DataGridViewTextBoxColumn L_ConfirmState; | |||
| private System.Windows.Forms.DataGridViewTextBoxColumn L_Order; | |||
| private System.Windows.Forms.DataGridViewTextBoxColumn L_PlanNumber; | |||
| private System.Windows.Forms.DataGridViewTextBoxColumn L_LiveColonyHouse_Name; | |||
| private System.Windows.Forms.DataGridViewTextBoxColumn L_AlreadyNumber; | |||
| private System.Windows.Forms.DataGridViewButtonColumn L_Start; | |||
| private System.Windows.Forms.DataGridViewButtonColumn L_End; | |||
| private WinFormControl.ULabel uLabel4; | |||
| private WinFormControl.ULabel orderLbl; | |||
| } | |||
| } | |||
| @ -0,0 +1,276 @@ | |||
| using ButcherManage.BO; | |||
| using ButcherManage.BO.Enums; | |||
| using ButcherManage.BO.LocalBL; | |||
| using ButcherManage.BO.Utils; | |||
| using ButcherManage.Dialogs; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.ComponentModel; | |||
| using System.Data; | |||
| using System.Drawing; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading; | |||
| using System.Windows.Forms; | |||
| using WinFormControl; | |||
| namespace ButcherManage.PickOutConfirm_ | |||
| { | |||
| public partial class PickOutConfirm : Form, IWithRoleForm | |||
| { | |||
| #region IWithRoleForm | |||
| public List<short> RoleName | |||
| { | |||
| get { return new List<short> { (short)设备类别.赶猪确认 }; } | |||
| } | |||
| public Form Generate() | |||
| { | |||
| return this; | |||
| } | |||
| #endregion | |||
| IList<PickOutConfirmDmo> list; | |||
| List<PickOutRecord> records; | |||
| long lastID = 0; | |||
| DateTime date = DateTime.Today; | |||
| bool start = false; | |||
| long startID = 0; | |||
| public PickOutConfirm() | |||
| { | |||
| InitializeComponent(); | |||
| this.FormClosing += (sender, e) => | |||
| { | |||
| if (start) | |||
| { | |||
| e.Cancel = MessageBox.Show("有开始状态的作业,确定退出?", "请确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK; | |||
| } | |||
| }; | |||
| } | |||
| protected override void OnLoad(EventArgs e) | |||
| { | |||
| base.OnLoad(e); | |||
| datePicker.Text = date.ToString("yyyy-MM-dd"); | |||
| BindGrid(); | |||
| FillNumberPad(); | |||
| if (list.Any()) | |||
| { | |||
| var tag = list.FirstOrDefault(x => x.ConfirmState == 1); | |||
| if (tag != null) | |||
| { | |||
| start = list.First().ConfirmState == 1; | |||
| startID = list.First().ID; | |||
| lastID = startID; | |||
| orderLbl.Text = tag.Order.ToString(); | |||
| } | |||
| RefreshRecordGrid(list.First().ID); | |||
| } | |||
| } | |||
| void RefreshRecordGrid(long id) | |||
| { | |||
| lastID = id; | |||
| records = PickOutConfirmBL.GetRecordList(lastID); | |||
| var row = records.Count % 5; | |||
| if (records.Count % 5 == 0) | |||
| { | |||
| records.Add(new PickOutRecord() { Order_ID = lastID }); | |||
| row = 0; | |||
| } | |||
| BindRecorGrid(); | |||
| BindLabel(); | |||
| recordGrid.Rows[records.Count / 5].Cells[row].Selected = true; | |||
| } | |||
| void BindLabel() | |||
| { | |||
| countLbl.Text = records.Where(x => x.Number > 0).Count().ToString(); | |||
| numberLbl.Text = records.Sum(x => x.Number).ToString(); | |||
| } | |||
| private void BindGrid() | |||
| { | |||
| list = PickOutConfirmBL.GetDmoList(date).OrderBy(x => x.Order).OrderByDescending(x => x.ConfirmState).ToList(); | |||
| orderGrid.DataSource = list; | |||
| foreach (DataGridViewRow row in orderGrid.Rows) | |||
| { | |||
| var v = (int)row.Cells["L_ConfirmState"].Value; | |||
| if (v == 1) | |||
| { | |||
| row.Cells[6] = new DataGridViewTextBoxCell(); | |||
| } | |||
| else if (v == -1 || list.Any(x => x.ConfirmState == 1)) | |||
| { | |||
| row.Cells[6] = new DataGridViewTextBoxCell(); | |||
| row.Cells[7] = new DataGridViewTextBoxCell(); | |||
| } | |||
| } | |||
| orderGrid.Refresh(); | |||
| } | |||
| private void FillNumberPad() | |||
| { | |||
| for (var i = 1; i < 10; i++) | |||
| CreateBtn(i.ToString()); | |||
| } | |||
| void CreateBtn(string content) | |||
| { | |||
| var btn = new NButton() { Width = 100, Height = 60, Text = content, Font = new Font("宋体", 15), Margin = new Padding(18, 10, 18, 20), PlaySound = true }; | |||
| btn.Click += NumberBtnClick; | |||
| numPad.Controls.Add(btn); | |||
| } | |||
| private void NumberBtnClick(object sender, EventArgs e) | |||
| { | |||
| if (!start) | |||
| { | |||
| NMessageBox.ShowDialog("请先开始"); | |||
| return; | |||
| } | |||
| else if (lastID != startID) | |||
| { | |||
| NMessageBox.ShowDialog("当前作业与选择的记录不一致"); | |||
| return; | |||
| } | |||
| var number = int.Parse((sender as NButton).Text); | |||
| var cell = recordGrid.CurrentCell; | |||
| if (cell.Value == null && number == 0) | |||
| return; | |||
| var idx = cell.RowIndex * 5 + cell.ColumnIndex; | |||
| var detail = new PickOutRecord(); | |||
| if (idx > records.Count - 1) | |||
| { | |||
| if (cell.RowIndex != records.Count / 5 || cell.ColumnIndex != records.Count % 5) | |||
| cell = recordGrid.Rows[records.Count / 5].Cells[records.Count % 5]; | |||
| detail.Order_ID = lastID; | |||
| detail.Number = number; | |||
| records.Add(detail); | |||
| } | |||
| else | |||
| { | |||
| detail = records[idx]; | |||
| detail.Number = number; | |||
| } | |||
| PickOutConfirmBL.SaveRecord(detail); | |||
| cell.Value = number; | |||
| var row = records.Count % 5; | |||
| if (records[records.Count - 1].Number == null) | |||
| row -= 1; | |||
| if (records.Count % 5 == 0) | |||
| { | |||
| records.Add(new PickOutRecord() { Order_ID = lastID }); | |||
| row = 0; | |||
| BindRecorGrid(); | |||
| } | |||
| recordGrid.Rows[records.Count / 5].Cells[row].Selected = true; | |||
| BindLabel(); | |||
| orderGrid.CurrentRow.Cells["L_AlreadyNumber"].Value = records.Sum(x => x.Number ?? 0); | |||
| } | |||
| void BindRecorGrid() | |||
| { | |||
| recordGrid.DataSource = Expand.Build(records); | |||
| recordGrid.Refresh(); | |||
| } | |||
| private void colseBtn_Click(object sender, EventArgs e) | |||
| { | |||
| Close(); | |||
| } | |||
| private void orderGrid_CellClick(object sender, DataGridViewCellEventArgs e) | |||
| { | |||
| var id = (long)orderGrid.CurrentRow.Cells[0].Value; | |||
| if (id == lastID) | |||
| return; | |||
| RefreshRecordGrid(id); | |||
| } | |||
| private void orderGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) | |||
| { | |||
| if (e.ColumnIndex < 6 || e.RowIndex == -1) | |||
| return; | |||
| if (e.ColumnIndex == 6)//开始 | |||
| { | |||
| PickOutConfirmBL.ChangeState(lastID, 1); | |||
| start = true; | |||
| startID = lastID; | |||
| orderLbl.Text = orderGrid.CurrentRow.Cells["L_Order"].Value.ToString(); | |||
| } | |||
| else//结束 | |||
| { | |||
| PickOutConfirmBL.ChangeState(lastID, -1); | |||
| start = false; | |||
| startID = 0; | |||
| orderLbl.Text = "0"; | |||
| } | |||
| BindGrid(); | |||
| } | |||
| private void datePicker_MouseDown(object sender, MouseEventArgs e) | |||
| { | |||
| var cs = new CalendarSelecter(); | |||
| if (cs.ShowDialog() == true) | |||
| { | |||
| date = cs.Result; | |||
| datePicker.Text = date.ToString("yyyy-MM-dd"); | |||
| } | |||
| } | |||
| private void queryBtn_Click(object sender, EventArgs e) | |||
| { | |||
| if (start) | |||
| { | |||
| NMessageBox.ShowDialog("有开始状态的作业,请结束后再尝试"); | |||
| return; | |||
| } | |||
| BindGrid(); | |||
| } | |||
| private void orderGrid_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) | |||
| { | |||
| DataGridViewRow dgrSingle = orderGrid.Rows[e.RowIndex]; | |||
| var v = (int)dgrSingle.Cells["L_ConfirmState"].Value; | |||
| if (v == 1) | |||
| dgrSingle.DefaultCellStyle.BackColor = Color.LightBlue; | |||
| else if (v == -1) | |||
| dgrSingle.DefaultCellStyle.BackColor = Color.YellowGreen; | |||
| } | |||
| } | |||
| class Expand | |||
| { | |||
| public int? Number1 { get; set; } | |||
| public int? Number2 { get; set; } | |||
| public int? Number3 { get; set; } | |||
| public int? Number4 { get; set; } | |||
| public int? Number5 { get; set; } | |||
| public static List<Expand> Build(List<PickOutRecord> list) | |||
| { | |||
| var result = new List<Expand>(); | |||
| var t = typeof(Expand); | |||
| for (var i = 0; i < list.Count; ) | |||
| { | |||
| var entity = new Expand(); | |||
| result.Add(entity); | |||
| for (var j = 1; j <= 5; j++) | |||
| { | |||
| t.GetProperty(string.Format("Number{0}", j)).SetValue(entity, list[i].Number); | |||
| i++; | |||
| if (i == list.Count) | |||
| break; | |||
| } | |||
| } | |||
| return result; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,159 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <root> | |||
| <!-- | |||
| Microsoft ResX Schema | |||
| Version 2.0 | |||
| The primary goals of this format is to allow a simple XML format | |||
| that is mostly human readable. The generation and parsing of the | |||
| various data types are done through the TypeConverter classes | |||
| associated with the data types. | |||
| Example: | |||
| ... ado.net/XML headers & schema ... | |||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||
| <resheader name="version">2.0</resheader> | |||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||
| </data> | |||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||
| <comment>This is a comment</comment> | |||
| </data> | |||
| There are any number of "resheader" rows that contain simple | |||
| name/value pairs. | |||
| Each data row contains a name, and value. The row also contains a | |||
| type or mimetype. Type corresponds to a .NET class that support | |||
| text/value conversion through the TypeConverter architecture. | |||
| Classes that don't support this are serialized and stored with the | |||
| mimetype set. | |||
| The mimetype is used for serialized objects, and tells the | |||
| ResXResourceReader how to depersist the object. This is currently not | |||
| extensible. For a given mimetype the value must be set accordingly: | |||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||
| that the ResXResourceWriter will generate, however the reader can | |||
| read any of the formats listed below. | |||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||
| value : The object must be serialized into a byte array | |||
| : using a System.ComponentModel.TypeConverter | |||
| : and then encoded with base64 encoding. | |||
| --> | |||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||
| <xsd:complexType> | |||
| <xsd:choice maxOccurs="unbounded"> | |||
| <xsd:element name="metadata"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||
| <xsd:attribute name="type" type="xsd:string" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="assembly"> | |||
| <xsd:complexType> | |||
| <xsd:attribute name="alias" type="xsd:string" /> | |||
| <xsd:attribute name="name" type="xsd:string" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="data"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="resheader"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:choice> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:schema> | |||
| <resheader name="resmimetype"> | |||
| <value>text/microsoft-resx</value> | |||
| </resheader> | |||
| <resheader name="version"> | |||
| <value>2.0</value> | |||
| </resheader> | |||
| <resheader name="reader"> | |||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <resheader name="writer"> | |||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <metadata name="L_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="L_ConfirmState.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="L_Order.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="L_PlanNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="L_LiveColonyHouse_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="L_AlreadyNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="L_Start.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="L_End.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="R_C1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="R_C2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="R_C3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="R_C4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="R_C5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| </root> | |||
| @ -0,0 +1,36 @@ | |||
| using System.Reflection; | |||
| using System.Runtime.CompilerServices; | |||
| using System.Runtime.InteropServices; | |||
| // 有关程序集的常规信息通过以下 | |||
| // 特性集控制。更改这些特性值可修改 | |||
| // 与程序集关联的信息。 | |||
| [assembly: AssemblyTitle("ButcherManage.Form")] | |||
| [assembly: AssemblyDescription("")] | |||
| [assembly: AssemblyConfiguration("")] | |||
| [assembly: AssemblyCompany("")] | |||
| [assembly: AssemblyProduct("ButcherManage.Form")] | |||
| [assembly: AssemblyCopyright("Copyright © 2018")] | |||
| [assembly: AssemblyTrademark("")] | |||
| [assembly: AssemblyCulture("")] | |||
| // 将 ComVisible 设置为 false 使此程序集中的类型 | |||
| // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, | |||
| // 则将该类型上的 ComVisible 特性设置为 true。 | |||
| [assembly: ComVisible(false)] | |||
| // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | |||
| [assembly: Guid("7d0ed13b-6e5f-48d9-9e0d-93ae40bfadb7")] | |||
| // 程序集的版本信息由下面四个值组成: | |||
| // | |||
| // 主版本 | |||
| // 次版本 | |||
| // 生成号 | |||
| // 修订号 | |||
| // | |||
| // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, | |||
| // 方法是按如下所示使用“*”: | |||
| // [assembly: AssemblyVersion("1.0.*")] | |||
| [assembly: AssemblyVersion("1.0.0.0")] | |||
| [assembly: AssemblyFileVersion("1.0.0.0")] | |||
| @ -0,0 +1,49 @@ | |||
| <Application x:Class="ButcherManage.Login.App" | |||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
| StartupUri="Login.xaml"> | |||
| <Application.Resources> | |||
| <Style x:Key="Exist" TargetType="Button"> | |||
| <Setter Property="Background" Value="#F6F6F6"/> | |||
| <Setter Property="Template"> | |||
| <Setter.Value> | |||
| <ControlTemplate TargetType="Button"> | |||
| <Border Name="border" BorderThickness="1" CornerRadius="3" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"> | |||
| <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
| </Border> | |||
| <ControlTemplate.Triggers> | |||
| <Trigger Property="IsMouseOver" Value="True"> | |||
| <Setter Property="Control.Background" Value="#BEE6FD"/> | |||
| </Trigger> | |||
| </ControlTemplate.Triggers> | |||
| </ControlTemplate> | |||
| </Setter.Value> | |||
| </Setter> | |||
| </Style> | |||
| <Style x:Key="Login" TargetType="Button"> | |||
| <Setter Property="Background"> | |||
| <Setter.Value> | |||
| <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> | |||
| <GradientStop Color="#FF055EB6" Offset="1"/> | |||
| <GradientStop Color="#FF1888F8"/> | |||
| </LinearGradientBrush> | |||
| </Setter.Value> | |||
| </Setter> | |||
| <Setter Property="Template"> | |||
| <Setter.Value> | |||
| <ControlTemplate TargetType="Button"> | |||
| <Border Name="border" BorderThickness="1" CornerRadius="3" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"> | |||
| <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
| </Border> | |||
| <ControlTemplate.Triggers> | |||
| <Trigger Property="IsMouseOver" Value="True"> | |||
| <Setter Property="Control.Background" Value="#00A2E8"/> | |||
| </Trigger> | |||
| </ControlTemplate.Triggers> | |||
| </ControlTemplate> | |||
| </Setter.Value> | |||
| </Setter> | |||
| </Style> | |||
| </Application.Resources> | |||
| </Application> | |||
| @ -0,0 +1,95 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Configuration; | |||
| using System.Data; | |||
| using System.Linq; | |||
| using System.Threading; | |||
| using System.Threading.Tasks; | |||
| using System.Windows; | |||
| using WinFormControl; | |||
| namespace ButcherManage.Login | |||
| { | |||
| /// <summary> | |||
| /// App.xaml 的交互逻辑 | |||
| /// </summary> | |||
| public partial class App : Application | |||
| { | |||
| public EventWaitHandle ProgramStarted { get; set; } | |||
| readonly string[] FOLDERS = new string[] { "Config", "PrintTemplate", "Log", "TempImg" }; | |||
| protected override void OnStartup(StartupEventArgs e) | |||
| { | |||
| bool createNew; | |||
| ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, "ButcherFactorySolution", out createNew); | |||
| if (!createNew) | |||
| { | |||
| NMessageBox.ShowDialog(@"系统已经在运行中,如果要重新启动,请从进程中关闭..."); | |||
| App.Current.Shutdown(); | |||
| } | |||
| System.Windows.Forms.Application.EnableVisualStyles(); | |||
| System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.CatchException); | |||
| System.Windows.Forms.Application.ThreadException += Application_ThreadException; | |||
| RegisterEvents(); | |||
| base.OnStartup(e); | |||
| foreach (var folder in FOLDERS) | |||
| { | |||
| if (!System.IO.Directory.Exists(folder)) | |||
| System.IO.Directory.CreateDirectory(folder); | |||
| } | |||
| var tempImages = new System.IO.DirectoryInfo("TempImg").GetFiles(); | |||
| foreach (var f in tempImages) | |||
| f.Delete(); | |||
| } | |||
| ///<summary> | |||
| /// 在发生未处理异常时处理的方法 | |||
| ///</summary> | |||
| ///<param name="sender"> </param> | |||
| ///<param name="e"> </param> | |||
| private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) | |||
| { | |||
| var ex = e.Exception; | |||
| var err = String.Empty; | |||
| if (ex != null) | |||
| { | |||
| //LogUtil.WriteError(ex); | |||
| err = ex.Message; | |||
| } | |||
| SoundPalyUtil.PlaySound(SoundType.Error); | |||
| NMessageBox.ShowDialog("错误:" + ex.Message + " \n详细信息:" + ex.StackTrace); | |||
| // UMessageBox.Show("错误:" + err); | |||
| } | |||
| private void RegisterEvents() | |||
| { | |||
| DispatcherUnhandledException += App_DispatcherUnhandledException; | |||
| TaskScheduler.UnobservedTaskException += (sender, args) => | |||
| { | |||
| SoundPalyUtil.PlaySound(SoundType.Error); | |||
| NMessageBox.ShowDialog("错误:" + args.Exception.Message + " \n详细信息:" + args.Exception.StackTrace); | |||
| args.SetObserved(); | |||
| }; | |||
| AppDomain.CurrentDomain.UnhandledException += (sender, args) => | |||
| { | |||
| SoundPalyUtil.PlaySound(SoundType.Error); | |||
| NMessageBox.ShowDialog("Unhandled exception." + args.ExceptionObject); | |||
| }; | |||
| } | |||
| void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) | |||
| { | |||
| SoundPalyUtil.PlaySound(SoundType.Error); | |||
| NMessageBox.ShowDialog("错误:" + e.Exception.Message + " \n详细信息:" + e.Exception.StackTrace); | |||
| e.Handled = true; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,119 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
| <PropertyGroup> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
| <ProjectGuid>{AA93C97D-E13D-48C7-906F-92CEF2628547}</ProjectGuid> | |||
| <OutputType>WinExe</OutputType> | |||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||
| <RootNamespace>ButcherManage.Login</RootNamespace> | |||
| <AssemblyName>ButcherManage.Login</AssemblyName> | |||
| <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | |||
| <WarningLevel>4</WarningLevel> | |||
| <TargetFrameworkProfile /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| <DebugType>full</DebugType> | |||
| <Optimize>false</Optimize> | |||
| <OutputPath>bin\Debug\</OutputPath> | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <DebugType>pdbonly</DebugType> | |||
| <Optimize>true</Optimize> | |||
| <OutputPath>bin\Release\</OutputPath> | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="System" /> | |||
| <Reference Include="System.Data" /> | |||
| <Reference Include="System.Windows.Forms" /> | |||
| <Reference Include="System.Xml" /> | |||
| <Reference Include="Microsoft.CSharp" /> | |||
| <Reference Include="System.Core" /> | |||
| <Reference Include="System.Xml.Linq" /> | |||
| <Reference Include="System.Data.DataSetExtensions" /> | |||
| <Reference Include="System.Xaml"> | |||
| <RequiredTargetFramework>4.0</RequiredTargetFramework> | |||
| </Reference> | |||
| <Reference Include="WindowsBase" /> | |||
| <Reference Include="PresentationCore" /> | |||
| <Reference Include="PresentationFramework" /> | |||
| <Reference Include="WinFormControl, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | |||
| <SpecificVersion>False</SpecificVersion> | |||
| <HintPath>..\..\..\tsref\Debug\WinFormControl.dll</HintPath> | |||
| </Reference> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ApplicationDefinition Include="App.xaml"> | |||
| <Generator>MSBuild:Compile</Generator> | |||
| <SubType>Designer</SubType> | |||
| </ApplicationDefinition> | |||
| <Compile Include="App.xaml.cs"> | |||
| <DependentUpon>App.xaml</DependentUpon> | |||
| <SubType>Code</SubType> | |||
| </Compile> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Compile Include="Login.xaml.cs"> | |||
| <DependentUpon>Login.xaml</DependentUpon> | |||
| </Compile> | |||
| <Compile Include="Properties\AssemblyInfo.cs"> | |||
| <SubType>Code</SubType> | |||
| </Compile> | |||
| <Compile Include="Properties\Resources.Designer.cs"> | |||
| <AutoGen>True</AutoGen> | |||
| <DesignTime>True</DesignTime> | |||
| <DependentUpon>Resources.resx</DependentUpon> | |||
| </Compile> | |||
| <Compile Include="Properties\Settings.Designer.cs"> | |||
| <AutoGen>True</AutoGen> | |||
| <DependentUpon>Settings.settings</DependentUpon> | |||
| <DesignTimeSharedInput>True</DesignTimeSharedInput> | |||
| </Compile> | |||
| <EmbeddedResource Include="Properties\Resources.resx"> | |||
| <Generator>ResXFileCodeGenerator</Generator> | |||
| <LastGenOutput>Resources.Designer.cs</LastGenOutput> | |||
| </EmbeddedResource> | |||
| <None Include="Properties\Settings.settings"> | |||
| <Generator>SettingsSingleFileGenerator</Generator> | |||
| <LastGenOutput>Settings.Designer.cs</LastGenOutput> | |||
| </None> | |||
| <AppDesigner Include="Properties\" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Resource Include="Images\login.png" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Page Include="Login.xaml"> | |||
| <SubType>Designer</SubType> | |||
| <Generator>MSBuild:Compile</Generator> | |||
| </Page> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ProjectReference Include="..\ButcherManage.BO\ButcherManage.BO.csproj"> | |||
| <Project>{b1ecbe2f-06fb-4e4c-9487-1497e0808c04}</Project> | |||
| <Name>ButcherManage.BO</Name> | |||
| </ProjectReference> | |||
| </ItemGroup> | |||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||
| Other similar extension points exist, see Microsoft.Common.targets. | |||
| <Target Name="BeforeBuild"> | |||
| </Target> | |||
| <Target Name="AfterBuild"> | |||
| </Target> | |||
| --> | |||
| </Project> | |||
| @ -0,0 +1,38 @@ | |||
| <Window x:Class="ButcherManage.Login.Login" | |||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
| Title="Login" Height="433" Width="622" WindowStyle="None" AllowsTransparency="True" ResizeMode="NoResize" MouseLeftButtonDown="Window_MouseLeftButtonDown" BorderThickness="40" > | |||
| <Window.Background> | |||
| <ImageBrush ImageSource="images/login.png"/> | |||
| </Window.Background> | |||
| <Window.Effect> | |||
| <DropShadowEffect BlurRadius="40" Color="#000000" ShadowDepth="0" Opacity="0.3"/> | |||
| </Window.Effect> | |||
| <Grid> | |||
| <Label Content="用户名:" FontFamily="微软雅黑" FontSize="22px" HorizontalAlignment="Left" Margin="140,152,0,0" VerticalAlignment="Top" Width="90"/> | |||
| <TextBox Name="userNameInput" HorizontalAlignment="Left" Height="33" Margin="233,158,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" FontFamily="微软雅黑" FontSize="17" Width="187" VerticalContentAlignment="Center" PreviewMouseLeftButtonDown="UserNameTextBoxClick"/> | |||
| <Label Content="密 码 :" FontFamily="微软雅黑" FontSize="22px" HorizontalAlignment="Left" Margin="142,202,0,0" VerticalAlignment="Top" Width="90" /> | |||
| <PasswordBox Name="pwdInput" HorizontalAlignment="Left" Height="33" Margin="233,208,0,0" VerticalAlignment="Top" FontSize="17" Width="187" VerticalContentAlignment="Center" PreviewMouseLeftButtonDown="PwdTextBoxClick"/> | |||
| <Button Style="{StaticResource Login}" Content="登录" Foreground="#FFFFFF" HorizontalAlignment="Left" Margin="233,260,0,0" VerticalAlignment="Top" Width="80" Height="40" FontSize="18" BorderBrush="#0675E3" Click="LoginBtn_Click"> | |||
| <!--<Button.Background> | |||
| <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> | |||
| <GradientStop Color="#FF055EB6" Offset="1"/> | |||
| <GradientStop Color="#FF1888F8"/> | |||
| </LinearGradientBrush> | |||
| </Button.Background>--> | |||
| <!--<Button.Style> | |||
| <Style TargetType="Button"> | |||
| <Style.Triggers> | |||
| <Trigger Property="IsMouseOver" Value="True"> | |||
| <Setter Property="Background" Value="Red" /> | |||
| </Trigger> | |||
| </Style.Triggers> | |||
| </Style> | |||
| </Button.Style>--> | |||
| </Button> | |||
| <Button Style="{StaticResource Exist}" Content="退出" HorizontalAlignment="Left" Margin="340,260,0,0" VerticalAlignment="Top" Width="80" Height="40" FontSize="18" BorderBrush="#A0A0A0" Click="ExistBtn_Click"/> | |||
| </Grid> | |||
| </Window> | |||
| @ -0,0 +1,100 @@ | |||
| using ButcherManage.BO.Utils; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| using System.Windows; | |||
| using System.Windows.Controls; | |||
| using System.Windows.Data; | |||
| using System.Windows.Documents; | |||
| using System.Windows.Input; | |||
| using System.Windows.Media; | |||
| using System.Windows.Media.Imaging; | |||
| using System.Windows.Shapes; | |||
| using WinFormControl; | |||
| namespace ButcherManage.Login | |||
| { | |||
| /// <summary> | |||
| /// Login.xaml 的交互逻辑 | |||
| /// </summary> | |||
| public partial class Login : Window | |||
| { | |||
| public Login() | |||
| { | |||
| InitializeComponent(); | |||
| #if DEBUG | |||
| pwdInput.Password = "123"; | |||
| #endif | |||
| try | |||
| { | |||
| userNameInput.Text = AppContext.Worker.Name; | |||
| if (!string.IsNullOrEmpty(AppContext.Worker.Name)) | |||
| pwdInput.Focus(); | |||
| } | |||
| catch { } | |||
| } | |||
| private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
| { | |||
| this.DragMove(); | |||
| } | |||
| private async void LoginBtn_Click(object sender, RoutedEventArgs e) | |||
| { | |||
| var username = userNameInput.Text.Trim(); | |||
| var pwd = pwdInput.Password; | |||
| if (string.IsNullOrEmpty(username)) | |||
| throw new Exception("请输入用户名"); | |||
| if (LoginUtil.TestConnection(1000)) | |||
| { | |||
| await Task.Factory.StartNew(() => LoginUtil.Login(username, pwd)); | |||
| } | |||
| else | |||
| { | |||
| if (!AppContext.ConnectInfo.LocalOffline) | |||
| throw new Exception("无法连接到远程服务器"); | |||
| if (AppContext.Worker.Name != username || string.Join("", LoginUtil.EncodePwd(pwd)) != string.Join("", AppContext.Worker.Password)) | |||
| throw new Exception("离线时只能使用上次登录信息登录"); | |||
| } | |||
| var form = FormUtil.CreateFrom(); | |||
| if (form == null) | |||
| throw new Exception("权限不符"); | |||
| form.FormClosing += delegate | |||
| { | |||
| this.Show(); | |||
| }; | |||
| form.Show(); | |||
| Hide(); | |||
| } | |||
| private void ExistBtn_Click(object sender, RoutedEventArgs e) | |||
| { | |||
| App.Current.Shutdown(); | |||
| } | |||
| private void UserNameTextBoxClick(object sender, MouseButtonEventArgs e) | |||
| { | |||
| var keyBoard = new NumberPad(); | |||
| if (keyBoard.ShowDialog() == true) | |||
| { | |||
| if (!LoginUtil.TestConnection(1000)) | |||
| { | |||
| if (string.IsNullOrEmpty(AppContext.Worker.Name)) | |||
| throw new Exception("请检查网络"); | |||
| throw new Exception("离线时无法切换用户"); | |||
| } | |||
| userNameInput.Text = LoginUtil.GetWorkerNameByCode(keyBoard.Result); | |||
| } | |||
| } | |||
| private void PwdTextBoxClick(object sender, MouseButtonEventArgs e) | |||
| { | |||
| var keyBoard = new VirtualKeyPad(); | |||
| if (keyBoard.ShowDialog() == true) | |||
| pwdInput.Password = keyBoard.Result; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,55 @@ | |||
| using System.Reflection; | |||
| using System.Resources; | |||
| using System.Runtime.CompilerServices; | |||
| using System.Runtime.InteropServices; | |||
| using System.Windows; | |||
| // 有关程序集的常规信息通过以下 | |||
| // 特性集控制。更改这些特性值可修改 | |||
| // 与程序集关联的信息。 | |||
| [assembly: AssemblyTitle("ButcherManage.Login")] | |||
| [assembly: AssemblyDescription("")] | |||
| [assembly: AssemblyConfiguration("")] | |||
| [assembly: AssemblyCompany("")] | |||
| [assembly: AssemblyProduct("ButcherManage.Login")] | |||
| [assembly: AssemblyCopyright("Copyright © 2018")] | |||
| [assembly: AssemblyTrademark("")] | |||
| [assembly: AssemblyCulture("")] | |||
| // 将 ComVisible 设置为 false 使此程序集中的类型 | |||
| // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, | |||
| // 则将该类型上的 ComVisible 特性设置为 true。 | |||
| [assembly: ComVisible(false)] | |||
| //若要开始生成可本地化的应用程序,请在 | |||
| //<PropertyGroup> 中的 .csproj 文件中 | |||
| //设置 <UICulture>CultureYouAreCodingWith</UICulture>。 例如,如果您在源文件中 | |||
| //使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消 | |||
| //对以下 NeutralResourceLanguage 特性的注释。 更新 | |||
| //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 | |||
| //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] | |||
| [assembly: ThemeInfo( | |||
| ResourceDictionaryLocation.None, //主题特定资源词典所处位置 | |||
| //(在页面或应用程序资源词典中 | |||
| // 未找到某个资源的情况下使用) | |||
| ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 | |||
| //(在页面、应用程序或任何主题特定资源词典中 | |||
| // 未找到某个资源的情况下使用) | |||
| )] | |||
| // 程序集的版本信息由下面四个值组成: | |||
| // | |||
| // 主版本 | |||
| // 次版本 | |||
| // 生成号 | |||
| // 修订号 | |||
| // | |||
| // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, | |||
| // 方法是按如下所示使用“*”: | |||
| // [assembly: AssemblyVersion("1.0.*")] | |||
| [assembly: AssemblyVersion("1.0.0.0")] | |||
| [assembly: AssemblyFileVersion("1.0.0.0")] | |||
| @ -0,0 +1,8 @@ | |||
| <Application x:Class="ButcherManage.Tools.App" | |||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
| StartupUri="MainWindow.xaml"> | |||
| <Application.Resources> | |||
| </Application.Resources> | |||
| </Application> | |||
| @ -0,0 +1,16 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Configuration; | |||
| using System.Data; | |||
| using System.Linq; | |||
| using System.Windows; | |||
| namespace ButcherManage.Tools | |||
| { | |||
| /// <summary> | |||
| /// App.xaml 的交互逻辑 | |||
| /// </summary> | |||
| public partial class App : Application | |||
| { | |||
| } | |||
| } | |||
| @ -0,0 +1,96 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
| <PropertyGroup> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
| <ProjectGuid>{26433793-6DB6-41FA-A531-8C674B79CFA0}</ProjectGuid> | |||
| <OutputType>WinExe</OutputType> | |||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||
| <RootNamespace>ButcherManage.Tools</RootNamespace> | |||
| <AssemblyName>ButcherManage.Tools</AssemblyName> | |||
| <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | |||
| <WarningLevel>4</WarningLevel> | |||
| <TargetFrameworkProfile /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| <DebugType>full</DebugType> | |||
| <Optimize>false</Optimize> | |||
| <OutputPath>bin\Debug\</OutputPath> | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <DebugType>pdbonly</DebugType> | |||
| <Optimize>true</Optimize> | |||
| <OutputPath>bin\Release\</OutputPath> | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| <Prefer32Bit>false</Prefer32Bit> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="System" /> | |||
| <Reference Include="System.Data" /> | |||
| <Reference Include="System.Xml" /> | |||
| <Reference Include="Microsoft.CSharp" /> | |||
| <Reference Include="System.Core" /> | |||
| <Reference Include="System.Xml.Linq" /> | |||
| <Reference Include="System.Data.DataSetExtensions" /> | |||
| <Reference Include="System.Xaml"> | |||
| <RequiredTargetFramework>4.0</RequiredTargetFramework> | |||
| </Reference> | |||
| <Reference Include="WindowsBase" /> | |||
| <Reference Include="PresentationCore" /> | |||
| <Reference Include="PresentationFramework" /> | |||
| <Reference Include="WinFormControl, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | |||
| <SpecificVersion>False</SpecificVersion> | |||
| <HintPath>..\..\..\tsref\Debug\WinFormControl.dll</HintPath> | |||
| </Reference> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ApplicationDefinition Include="App.xaml"> | |||
| <Generator>MSBuild:Compile</Generator> | |||
| <SubType>Designer</SubType> | |||
| </ApplicationDefinition> | |||
| <Page Include="MainWindow.xaml"> | |||
| <Generator>MSBuild:Compile</Generator> | |||
| <SubType>Designer</SubType> | |||
| </Page> | |||
| <Compile Include="App.xaml.cs"> | |||
| <DependentUpon>App.xaml</DependentUpon> | |||
| <SubType>Code</SubType> | |||
| </Compile> | |||
| <Compile Include="MainWindow.xaml.cs"> | |||
| <DependentUpon>MainWindow.xaml</DependentUpon> | |||
| <SubType>Code</SubType> | |||
| </Compile> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Compile Include="Properties\AssemblyInfo.cs"> | |||
| <SubType>Code</SubType> | |||
| </Compile> | |||
| <AppDesigner Include="Properties\" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ProjectReference Include="..\ButcherManage.BO\ButcherManage.BO.csproj"> | |||
| <Project>{b1ecbe2f-06fb-4e4c-9487-1497e0808c04}</Project> | |||
| <Name>ButcherManage.BO</Name> | |||
| </ProjectReference> | |||
| </ItemGroup> | |||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||
| Other similar extension points exist, see Microsoft.Common.targets. | |||
| <Target Name="BeforeBuild"> | |||
| </Target> | |||
| <Target Name="AfterBuild"> | |||
| </Target> | |||
| --> | |||
| </Project> | |||
| @ -0,0 +1,16 @@ | |||
| <Window x:Class="ButcherManage.Tools.MainWindow" | |||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
| Title="BWP_Tools" Height="380" Width="525" ResizeMode="NoResize" > | |||
| <Grid Margin="0,0,2,0"> | |||
| <Label Content="服务器:" HorizontalAlignment="Left" VerticalContentAlignment="Center" FontSize="18px" Margin="84,30,0,0" VerticalAlignment="Top" Height="47"/> | |||
| <TextBox Name="serverUrlBox" HorizontalAlignment="Left" Height="80" Margin="179,34,0,0" TextWrapping="Wrap" FontSize="15px" Text="" VerticalAlignment="Top" Width="229" PreviewMouseLeftButtonDown="ServerUrlTextBoxClick"/> | |||
| <Label Content="本机离线:" HorizontalAlignment="Left" VerticalContentAlignment="Center" FontSize="18px" Margin="69,121,0,0" VerticalAlignment="Top" Height="47"/> | |||
| <CheckBox Name="localOffline" Content="" HorizontalAlignment="Left" Margin="179,142,0,0" VerticalAlignment="Top"/> | |||
| <Label Content="数据库:" HorizontalAlignment="Left" VerticalContentAlignment="Center" FontSize="18px" Margin="84,178,0,0" VerticalAlignment="Top" Height="47"/> | |||
| <ComboBox Name="dbComboBox" HorizontalAlignment="Left" Margin="179,184,0,0" FontSize="18px" VerticalContentAlignment="Center" VerticalAlignment="Top" Width="229" Height="37"/> | |||
| <Button Content="保存" FontSize="18px" Margin="72,254,0,0" Height="50" Width="94" HorizontalAlignment="Left" VerticalAlignment="Top" Click="SaveBtnClick"/> | |||
| <Button Content="升级" FontSize="18px" Margin="197,254,0,0" Height="50" Width="94" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Button_Click"/> | |||
| <Button Content="关闭" FontSize="18px" Margin="320,254,0,0" Height="50" Width="94" HorizontalAlignment="Left" VerticalAlignment="Top" Click="CloseBtnClick"/> | |||
| </Grid> | |||
| </Window> | |||
| @ -0,0 +1,83 @@ | |||
| using ButcherManage.BO.Utils; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Windows; | |||
| using System.Windows.Controls; | |||
| using System.Windows.Data; | |||
| using System.Windows.Documents; | |||
| using System.Windows.Input; | |||
| using System.Windows.Media; | |||
| using System.Windows.Media.Imaging; | |||
| using System.Windows.Navigation; | |||
| using System.Windows.Shapes; | |||
| using WinFormControl; | |||
| namespace ButcherManage.Tools | |||
| { | |||
| /// <summary> | |||
| /// MainWindow.xaml 的交互逻辑 | |||
| /// </summary> | |||
| public partial class MainWindow : Window | |||
| { | |||
| public MainWindow() | |||
| { | |||
| InitializeComponent(); | |||
| var list = XmlUtil.DeserializeFromFile<List<DbSelectEntity>>("Config\\DbSelectList.xml"); | |||
| dbComboBox.SelectedValuePath = "Value"; | |||
| dbComboBox.DisplayMemberPath = "Name"; | |||
| dbComboBox.ItemsSource = list; | |||
| var idx = list.FindIndex(x => x.Value == AppContext.ConnectInfo.SqlConnection); | |||
| if (idx > -1) | |||
| dbComboBox.SelectedIndex = idx; | |||
| this.serverUrlBox.Text = AppContext.ConnectInfo.ServerUrl; | |||
| this.localOffline.IsChecked = AppContext.ConnectInfo.LocalOffline; | |||
| } | |||
| private void Button_Click(object sender, RoutedEventArgs e) | |||
| { | |||
| if (!AppContext.ConnectInfo.LocalOffline) | |||
| throw new Exception("非离线模式无需升级数据库"); | |||
| DbUtil.UpdateDatabase(AppContext.ConnectInfo.SqlConnection); | |||
| MessageBox.Show("数据库升级成功"); | |||
| } | |||
| private void SaveBtnClick(object sender, RoutedEventArgs e) | |||
| { | |||
| string uri = this.serverUrlBox.Text.Trim(); | |||
| if (string.IsNullOrEmpty(uri)) | |||
| throw new Exception("请先设置服务器地址"); | |||
| if (AppContext.ConnectInfo.LocalOffline && string.IsNullOrEmpty(AppContext.ConnectInfo.SqlConnection)) | |||
| throw new Exception("本机离线必须选择数据库"); | |||
| AppContext.ConnectInfo.ServerUrl = uri; | |||
| AppContext.ConnectInfo.SqlConnection = (string)dbComboBox.SelectedValue; | |||
| AppContext.ConnectInfo.LocalOffline = this.localOffline.IsChecked.Value; | |||
| AppContext.ConnectInfo.Save(); | |||
| MessageBox.Show("设置保存成功!"); | |||
| } | |||
| private void CloseBtnClick(object sender, RoutedEventArgs e) | |||
| { | |||
| Application.Current.Shutdown(); | |||
| } | |||
| private void ServerUrlTextBoxClick(object sender, MouseButtonEventArgs e) | |||
| { | |||
| serverUrlBox.Focus(); | |||
| var keyBoard = new VirtualKeyPad(); | |||
| if (keyBoard.ShowDialog() == true) | |||
| serverUrlBox.Text = keyBoard.Result; | |||
| } | |||
| } | |||
| public class DbSelectEntity | |||
| { | |||
| public string Name { get; set; } | |||
| public string Value { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,55 @@ | |||
| using System.Reflection; | |||
| using System.Resources; | |||
| using System.Runtime.CompilerServices; | |||
| using System.Runtime.InteropServices; | |||
| using System.Windows; | |||
| // 有关程序集的常规信息通过以下 | |||
| // 特性集控制。更改这些特性值可修改 | |||
| // 与程序集关联的信息。 | |||
| [assembly: AssemblyTitle("ButcherManage.Tools")] | |||
| [assembly: AssemblyDescription("")] | |||
| [assembly: AssemblyConfiguration("")] | |||
| [assembly: AssemblyCompany("")] | |||
| [assembly: AssemblyProduct("ButcherManage.Tools")] | |||
| [assembly: AssemblyCopyright("Copyright © 2018")] | |||
| [assembly: AssemblyTrademark("")] | |||
| [assembly: AssemblyCulture("")] | |||
| // 将 ComVisible 设置为 false 使此程序集中的类型 | |||
| // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, | |||
| // 则将该类型上的 ComVisible 特性设置为 true。 | |||
| [assembly: ComVisible(false)] | |||
| //若要开始生成可本地化的应用程序,请在 | |||
| //<PropertyGroup> 中的 .csproj 文件中 | |||
| //设置 <UICulture>CultureYouAreCodingWith</UICulture>。 例如,如果您在源文件中 | |||
| //使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消 | |||
| //对以下 NeutralResourceLanguage 特性的注释。 更新 | |||
| //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 | |||
| //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] | |||
| [assembly: ThemeInfo( | |||
| ResourceDictionaryLocation.None, //主题特定资源词典所处位置 | |||
| //(在页面或应用程序资源词典中 | |||
| // 未找到某个资源的情况下使用) | |||
| ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 | |||
| //(在页面、应用程序或任何主题特定资源词典中 | |||
| // 未找到某个资源的情况下使用) | |||
| )] | |||
| // 程序集的版本信息由下面四个值组成: | |||
| // | |||
| // 主版本 | |||
| // 次版本 | |||
| // 生成号 | |||
| // 修订号 | |||
| // | |||
| // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, | |||
| // 方法是按如下所示使用“*”: | |||
| // [assembly: AssemblyVersion("1.0.*")] | |||
| [assembly: AssemblyVersion("1.0.0.0")] | |||
| [assembly: AssemblyFileVersion("1.0.0.0")] | |||