static void TestEnum() { Console.WriteLine("============== TestEnum Start ==============="); //Console.WriteLine(Enum.IsDefined(typeof(EE), 1L));// fxxk, enum内置类型不对也不行,这TM是个判断函数呀,ToObject都不报错。。 Console.WriteLine(Enum.IsDefined(typeof(EE), 7u)); EE e = EE.A | EE.B | EE.C; Console.WriteLine(Enum.IsDefined(typeof(EE), e)); Console.WriteLine(typeof(EE).IsEnumDefined(e)); Console.WriteLine($"{e} {(int)e}"); e = (EE)Enum.ToObject(typeof(EE), 3); Console.WriteLine($"{e} {(int)e}"); e = (EE)Enum.ToObject(typeof(EE), 9); Console.WriteLine($"{e} {(int)e}"); //e = (EE)Enum.ToObject(typeof(EE), 9.3);// 异常 //Console.WriteLine($"{e} {(int)e}"); e = (EE)Enum.ToObject(typeof(EE), 9999999999999999999); Console.WriteLine($"{e} {(uint)e} {Convert.ToUInt64(e)}"); Console.WriteLine($"{Enum.Parse(typeof(EE),"A" )}"); Console.WriteLine($"{Enum.Parse(typeof(EE), "A,B")}"); Console.WriteLine($"{Enum.Parse(typeof(EE), "3")}"); Console.WriteLine($"{Enum.Parse(typeof(EE), "33")}"); //Console.WriteLine($"{Enum.Parse(typeof(EE), "A,B,D")}");// error Console.WriteLine($"{Enum.Parse(typeof(EE), "B,A")}"); Console.WriteLine("============== TestEnum End ==============="); }
private void DetecterCallback(object stateInfo) { try { if (Session != null) { if (Session.Socket == null) { Session.Reconnect(); return; } if (!Session.Socket.Connected) { if (!Session.IsSocketConnected()) { Session.Reconnect(); } } } } catch (Exception ex) { EE.LogError("Detecter connection Error", ex, log); } }
public static MsGenerateSql SelectFromTable <T>() { Type Root = typeof(T); msSQL = new MSSQL(); msSQL.displayItem = ""; msSQL.whereSql = ""; msSQL.rootTable = ""; msSQL.headCmd = ""; displayItemMap.Clear(); msSQL.rootTable = Root.Name; Dictionary <string, string> tempMap = EE.GetAllEntityPropertyName <T>(); foreach (var temp in tempMap) { if (!displayItemMap.ContainsKey(temp.Key)) { displayItemMap.Add(temp.Key, temp.Value); } } return(sqlObject); }
private static MsGenerateSql Join <T1, T2>(JoinType joinType, string OnCondition) { Type A = typeof(T1); Type B = typeof(T2); JoinRelationship item = new JoinRelationship(); item.JoinTableName = A.Name; //Join 表的名称 item.OnCondition = OnCondition; //Join条件 item.JoinTableAsName = item.JoinTableName; //Join表的别名 item.joinType = joinType; //Join类型 例如 Left Join ,Right Join ,Inner Join if (jrsList.Find(x => x.JoinTableName == item.JoinTableName) != null) { item.JoinTableAsName = item.JoinTableAsName + "COPY";//防止表别名重复 } Dictionary <string, string> tempMap = EE.GetAllEntityPropertyName <T1>(); foreach (var temp in tempMap) { if (!displayItemMap.ContainsKey(temp.Key)) { displayItemMap.Add(temp.Key, temp.Value); } } jrsList.Add(item); return(sqlObject); }
private void LoadPlantcode() { try { SqlDataReader dr = null; ddl_Plantcode.Items.Clear(); ddl_Plantname.Items.Clear(); dr = Bllusers.LoadPlantcode(ccode.ToString()); if (dr.HasRows) { while (dr.Read()) { ddl_Plantcode.Items.Add(dr["Plant_Code"].ToString()); ddl_Plantname.Items.Add(dr["Plant_Code"].ToString() + "_" + dr["Plant_Name"].ToString()); } } else { ddl_Plantcode.Items.Add("--Select PlantName--"); ddl_Plantname.Items.Add("--Select Plantcode--"); } } catch (Exception EE) { string message; message = EE.ToString(); string script = "window.onload = function(){ alert('"; script += message; script += "')};"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); } }
public void PlayAA() { AA.Play(); BB.Play(); CC.Play(); DD.Play(); EE.Play(); }
private Card(string rootWord, int id, EE partSpeech) //, string tie) { if (string.IsNullOrEmpty(rootWord)) { throw new ArgumentNullException("targetWord"); } this.m_RootWord = rootWord.ToLower(); this.m_ID = id; this.m_PartSpeech = partSpeech; // this.m_TieName = tie; }
public void Load(List <MemoryFile> files) { foreach (MemoryFile objT in files) { string ext = get_ext(objT.FileName); if (ext == ".png" || ext == ".jpg" || ext == ".bmp") { EE.Log("add texture: " + objT.FileName); using (MemoryStream b = new MemoryStream(objT.Data)) { IResource addinit = new Texture(b, objT.FileName); this._tree.Add(addinit); } objT.IsFree = true; } if (ext == ".mtl") { EE.Log("add text: " + objT.FileName); this._tree.Add(new UnknownResource(objT.FileName, objT.Data)); objT.IsFree = true; } } foreach (MemoryFile objT in files) { string ext = get_ext(objT.FileName); if (ext == ".obj") { Obj3DModel md = new Obj3DModel(); string fname = objT.FileName; fname = fname.Remove(fname.LastIndexOf('.'), 4); md.Parse(this, new MemoryStream(objT.Data), fname); EE.Log("add 3dModel: " + objT.FileName); this._tree.Add(md); objT.IsFree = true; } } foreach (MemoryFile objT in files) { if (!objT.IsFree) { EE.Log("add res: " + objT.FileName); this._tree.Add(new UnknownResource(objT.FileName, objT.Data)); objT.IsFree = true; } } }
private static bool _setup() { _typeList = new List <Type>(); AddType(typeof(BoxObject)); AddType(typeof(PlatformObject)); AddType(typeof(MiniPlatformObject)); AddType(typeof(WoodPlank)); AddType(typeof(WoodDoor)); AddType(typeof(CarObjectPickUp)); EE.Log("MapLoader::_setup OK"); return(true); }
public MsGenerateSql AutoMapDisplayItem <T>() { Dictionary <string, string> tempMap = EE.GetAllEntityPropertyName <T>(); foreach (var temp in tempMap) { if (displayItemMap.ContainsKey(temp.Key)) { msSQL.displayItem = msSQL.displayItem + " " + "[" + displayItemMap[temp.Key] + "].[" + temp.Key + "]" + endDisplayFormat; } } return(sqlObject); }
private void button1_Click(object sender, EventArgs e) { try { CarObject vs = new CarObject(); vs.Position = new JVector(0f, 4f, 0f); inst.AddObject(vs); } catch (Exception ex) { EE.Log(ex.ToString()); } }
public void Compile(string source) { EE.Log("Shader Compiled {0}", Type); GL.ShaderSource(Handle, source); GL.CompileShader(Handle); int compileStatus; GL.GetShader(Handle, ShaderParameter.CompileStatus, out compileStatus); // Если произошла ошибка, выведем сообщение if (compileStatus == 0) { EE.Log(GL.GetShaderInfoLog(Handle)); } }
protected void Button5_Click(object sender, EventArgs e) { try { getgridviewrows(); } catch (Exception EE) { string message; message = EE.ToString(); string script = "window.onload = function(){ alert('"; script += message; script += "')};"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); } }
void OnSessionDataReceived(object sender, DataEventArgs e) { ProcessResult result; try { result = PipeLineProcessor.Process(new ArraySegment <byte>(e.Data, e.Offset, e.Length)); } catch (Exception exc) { OnError(exc); m_Session.Close(); EE.LogError("Receive Data Fail:", exc, log); return; } if (result.State == ProcessState.Error) { m_Session.Close(); return; } else if (result.State == ProcessState.Cached) { // allocate new receive buffer if the previous one was cached var session = m_Session; if (session != null) { var bufferSetter = session as IBufferSetter; if (bufferSetter != null) { bufferSetter.SetBuffer(new ArraySegment <byte>(new byte[session.ReceiveBufferSize])); } } } if (result.Packages != null && result.Packages.Count > 0) { foreach (var item in result.Packages) { HandlePackage(item); } } }
public static string GetReadableName(EE e) { if (e == EE.adj || e == EE.adj2) { return(Parts[0]); } else if (e == EE.adv) { return(Parts[1]); } else if (e == EE.n) { return(Parts[2]); } else if (e == EE.v) { return(Parts[3]); } return("?"); }
void OnTriggerEnter(Collider other) { if (other.tag == "BB") { BB.Play(); } if (other.tag == "DD") { DD.Play(); } if (other.tag == "PlayNarrator") { EE.Play(); } if (other.tag == "StopNarrator") { EE.Stop(); } /* public AudioClip AA, BB, CC, DD; * public float Volume; * AudioSource audio; * public bool alreadyPlayer = false; * * * private void Start() * { * audio.GetComponent<AudioSource>(); * } * * * void OnTriggerEnter() * { * if (!alreadyPlayer) * { * audio.PlayOneShot(BB, Volume); * alreadyPlayer = true; * }*/ }
void OnTriggerEnter(Collider other) { if (other.tag == "BB") { BB.Play(); } if (other.tag == "CC") { CC.Play(); } if (other.tag == "DD") { DD.Play(); } if (other.tag == "PlayNarrator") { EE.Play(); } if (other.tag == "StopNarrator") { EE.Stop(); } }
private void TryToSelectObject(int Window_Width, int Window_Height, int m_b_X, int m_b_Y) { //Console.WriteLine("Try to selection Changed."); try { Vector3 rayS = new Vector3(); Vector3 rayE = new Vector3(); Projection.PushRay(m_b_X /*- (Window_Width / 2)*/, m_b_Y /*- (Window_Height / 2)*/, Window_Width, Window_Height, ref rayS, ref rayE); //Console.WriteLine("{0}, {1}",rayS, rayE); float flst = 0f; JVector normal; RigidBody body; this.InstanceFromGame.World.CollisionSystem.Raycast(EE.Vector(rayS), EE.Vector(rayE), (aa, ba, ca) => true /*!aa.IsStatic*/, out body, out normal, out flst); if (body != null) { Selection = (((ObjectivBody)body).BodyGameObject); ((MainForm)this.InstanceFromGui).SelectionName.Text = Selection.Name; } } catch (Exception) { } }
/// <summary> /// 断线重连函数 /// </summary> /// <returns></returns> public override bool Reconnect() { try { string remote = ""; if (m_RemoteEndPoint != null && m_RemoteEndPoint is IPEndPoint ipEndPoint) { remote = $"{ ipEndPoint.Address}:{ipEndPoint.Port}"; } log.Warn($"Reconnect to {remote}"); Close(); Connect(m_RemoteEndPoint); ConnectTimeout.Reset(); if (ConnectTimeout.WaitOne(10000, false))//直到timeout,或者TimeoutObject.se { return(IsConnected); } } catch (Exception ex) { EE.LogError("Reconnect Error", ex, log); } return(false); }
//打包主流程 private void copyDecompileFile(string game, string channel, ProgressBar pro, Label lb) { // 拷贝游戏 copyFolder(fromPath, envConfig.targetPath + @game + @"\" + channel + @"\", pro, lb, game); // 保存参数文件--assets string propertiesFile = envConfig.gameConfig + game + @"\" + channel + envConfig.configExt; if (!Directory.Exists(envConfig.targetPath + @game + @"\" + channel + @"\assets\")) { Directory.CreateDirectory(envConfig.targetPath + @game + @"\" + channel + @"\assets\"); } if (getNum == fileNum) { File.Copy(propertiesFile, envConfig.targetPath + @game + @"\" + channel + @"\assets\" + game + envConfig.configExt, true); curEvent.Text = "copy " + channel + " 完成."; pbT.Value = 20; } //合并文件 string apkBase = envConfig.channelPath + channel + @"\apkBase\"; if (!Directory.Exists(apkBase)) { MessageBox.Show("不存在sdk母包文件"); return; } File.Delete(apkBase + @"AndroidManifest.xml"); File.Delete(apkBase + @"apktool.yml"); mergeFolder(envConfig.targetPath + @game + @"\" + channel + @"\", apkBase, pro, lb, channel); // propertiesFile = envConfig.gameConfig + game + @"\" + channel + envConfig.configExt; File.Copy(propertiesFile, envConfig.targetPath + @game + @"\" + channel + @"\assets\" + game + envConfig.configExt, true); //检测游戏母包是否还有其他文件操作 delArmeabi(game, envConfig.targetPath + @game + @"\" + channel + @"\lib"); fileNum = 0; //todo merge xml string gameXml = envConfig.targetPath + @game + @"\" + channel + @"\AndroidManifest.xml"; string xxxPath = envConfig.targetPath + @game + @"\" + channel + @"\res\drawable-xxxhdpi\"; if (Directory.Exists(xxxPath)) { FileUtil.deleteFolder(xxxPath); } curEvent.Text = "合并" + gameXml; this.mergeXml(gameXml, channel); curEvent.Text = "xml合并完成"; pro.Value = 60; pbT.Value = 60; lb.Text = "60%"; //todo replace packageName string oldName = getPackName(gameXml); PpHelper pt = new PpHelper(propertiesFile); string packageName = pt.GetPropertiesText("package"); this.replaceSpecGameXml(game, gameXml, packageName, oldName); //todo 特殊游戏包名 if (packageName.Length > 0) { XmlHelper.XmlAttributeEdit(gameXml, "manifest", "package", packageName); } string tmpXml1 = FileUtil.setXmlColon(FileUtil.getContent(gameXml)); string xmlTmpFile1 = gameXml + @".tmp"; FileUtil.writeContent(xmlTmpFile1, tmpXml1); XmlDocument dDoc = new XmlDocument(); dDoc.Load(xmlTmpFile1); XmlNode dpath = dDoc.SelectSingleNode(@"//manifest/application"); XmlElement dXe = (XmlElement)dpath; // dXe.GetAttribute("android" + FileUtil.colon + "debuggable"); dXe.SetAttribute("android" + FileUtil.colon + "debuggable", "false"); dDoc.Save(xmlTmpFile1); tmpXml1 = FileUtil.replaceXmlColon(FileUtil.getContent(xmlTmpFile1)); tmpXml1 = FileUtil.xmlRestore(tmpXml1); FileUtil.writeContent(gameXml, tmpXml1); File.Delete(xmlTmpFile1); // string tmpXml = FileUtil.setXmlColon(FileUtil.getContent(gameXml)); pbT.Value = 61; pro.Value = 61; lb.Text = "61%"; curEvent.Text = "包名替换完成"; //todo copy ico if (picString.Length > 0) { string tmpXml = FileUtil.setXmlColon(FileUtil.getContent(gameXml)); string xmlTmpFile = gameXml + @".tmp"; FileUtil.writeContent(xmlTmpFile, tmpXml); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlTmpFile); XmlNode basePath = xmlDoc.SelectSingleNode(@"//manifest/application"); XmlElement baseXe = (XmlElement)basePath; string icoName = baseXe.GetAttribute("android" + FileUtil.colon + "icon"); icoName = icoName.Substring(icoName.IndexOf('/') + 1); copyIco(picString, envConfig.targetPath + @game + @"\" + channel + @"\res\", icoName + ".png", channel); tmpXml = FileUtil.replaceXmlColon(FileUtil.getContent(xmlTmpFile)); tmpXml = FileUtil.xmlRestore(tmpXml); FileUtil.writeContent(gameXml, tmpXml); File.Delete(xmlTmpFile); } //todo 检测渠道XML是否有特殊操作 try { updateChannelXml(game, channel, gameXml, propertiesFile); } catch (Exception EE) { MessageBox.Show(EE.ToString()); } curEvent.Text = "特殊渠道xml处理完成"; //todo merge res *.xml this.mergeRes(channel, game); pbT.Value = 65; pro.Value = 65; lb.Text = "65%"; curEvent.Text = "res xml 合并完成"; //todo make R.java //todo compile class file //todo make dex //todo make smali //todo merge smali string targetPath = envConfig.targetPath + game + @"\" + channel + @"\"; string resPath = targetPath + "res"; string tmpFolder = envConfig.upPath + @"temp\"; string tmpCls = tmpFolder + @"class\"; string tmpR = tmpFolder + @"R\"; if (Directory.Exists(tmpR)) { FileUtil.deleteFolder(tmpR); } Directory.CreateDirectory(tmpR); if (Directory.Exists(tmpCls)) { FileUtil.deleteFolder(tmpCls); } Directory.CreateDirectory(tmpCls); string packagePath = packageName.Replace(".", @"\"); string javaFilePath = tmpR + packagePath; // MessageBox.Show("java file:"+javaFilePath); curEvent.Text = "开始生成R文件"; Process makeR = new Process(); if (this.isDebug() == false) { makeR.StartInfo.UseShellExecute = false; makeR.StartInfo.CreateNoWindow = true; makeR.StartInfo.FileName = envConfig.toolPath + @"\makeR.bat"; makeR.StartInfo.RedirectStandardInput = true; makeR.StartInfo.RedirectStandardOutput = true; makeR.StartInfo.RedirectStandardError = true; } else { makeR.StartInfo.FileName = envConfig.toolPath + @"\makeR-debug.bat"; } makeR.StartInfo.Arguments = " " + resPath + " " + targetPath + "AndroidManifest.xml" + " " + tmpR + " " + tmpCls + " " + javaFilePath + " " + envConfig.targetPath + @game + @"\" + channel + @"\assets\"; makeR.Start(); string line = "\r\n"; StreamReader reader = null; if (this.isDebug() == false) { reader = makeR.StandardOutput; //截取输出流 line = reader.ReadLine(); //每次读取一行 while (!reader.EndOfStream) { line = reader.ReadLine(); line += "\r\n" + line; richTxtInfo.AppendText(line); richTxtInfo.SelectionStart = richTxtInfo.Text.Length; richTxtInfo.ScrollToCaret(); } } makeR.WaitForExit(); pbT.Value = 70; pro.Value = 70; lb.Text = "70%"; curEvent.Text = "R文件生成完成"; richTxtInfo.AppendText("\r\n R文件生成完成\r\n"); if (makeRYes.Checked == true) { string channelXml = envConfig.channelPath + channel + @"\channel.xml"; string chanelPackage = XmlHelper.getChannelAtrr(channelXml, "chanelPackage"); MessageBox.Show(chanelPackage); makeChannelRes(channel, pro, lb); } curEvent.Text = "生成class文件"; Process makeDex = new Process(); if (this.isDebug() == false) { makeDex.StartInfo.UseShellExecute = false; makeDex.StartInfo.CreateNoWindow = true; makeDex.StartInfo.FileName = envConfig.toolPath + @"\dx.bat"; makeDex.StartInfo.RedirectStandardInput = true; makeDex.StartInfo.RedirectStandardOutput = true; makeDex.StartInfo.RedirectStandardError = true; } else { makeDex.StartInfo.FileName = envConfig.toolPath + @"\dx.bat"; } makeDex.StartInfo.Arguments = " --dex --output=" + tmpFolder + "temp.dex " + tmpCls; makeDex.Start(); line = "\r\n"; if (this.isDebug() == false) { reader = makeDex.StandardOutput; //截取输出流 line = reader.ReadLine(); //每次读取一行 while (!reader.EndOfStream) { line = reader.ReadLine(); line += "\r\n" + line; richTxtInfo.AppendText(line); richTxtInfo.SelectionStart = richTxtInfo.Text.Length; richTxtInfo.ScrollToCaret(); } } makeDex.WaitForExit(); richTxtInfo.AppendText("\r\n class文件生成完成\r\n"); curEvent.Text = "生成smali"; Process makeSmali = new Process(); if (this.isDebug() == false) { makeSmali.StartInfo.UseShellExecute = false; makeSmali.StartInfo.CreateNoWindow = true; makeSmali.StartInfo.FileName = envConfig.toolPath + @"\getSmali.bat"; makeSmali.StartInfo.RedirectStandardInput = true; makeSmali.StartInfo.RedirectStandardOutput = true; makeSmali.StartInfo.RedirectStandardError = true; } else { makeSmali.StartInfo.FileName = envConfig.toolPath + @"\getSmali-debug.bat"; MessageBox.Show("begin"); } makeSmali.StartInfo.Arguments = targetPath + @"smali\ " + tmpFolder + "temp.dex "; makeSmali.Start(); line = "\r\n"; if (this.isDebug() == false) { reader = makeSmali.StandardOutput; //截取输出流 line = reader.ReadLine(); //每次读取一行 while (!reader.EndOfStream) { line = reader.ReadLine(); line += "\r\n" + line; richTxtInfo.AppendText(line); richTxtInfo.SelectionStart = richTxtInfo.Text.Length; richTxtInfo.ScrollToCaret(); } } makeSmali.WaitForExit(); pbT.Value = 75; pro.Value = 75; lb.Text = "75%"; curEvent.Text = "smali 合并完成"; richTxtInfo.AppendText("\r\n" + "smali 合并完成\r\n"); FileUtil.deleteFolder(tmpR); FileUtil.deleteFolder(tmpCls); File.Delete(tmpFolder + "temp.dex"); string packageFolder = envConfig.targetPath + @game + @"\" + channel + @"\"; string compileFolder = envConfig.compileFolder + game + @"\"; string mkTime = DateTime.Now.ToString("yyyyMMddHHmmss"); string compileApkName = channel + "_" + mkTime + ".apk"; Process p = new Process(); if (this.isDebug() == false) { p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo.FileName = envConfig.apkToolCommand; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; } else { p.StartInfo.FileName = envConfig.currenPath + @"\apktool\apktool-debug.bat"; } string compileApk = compileFolder + compileApkName; p.StartInfo.Arguments = " b " + packageFolder + " -o " + compileApk; p.Start(); line = "\r\n"; if (this.isDebug() == false) { reader = p.StandardOutput; //截取输出流 line = reader.ReadLine(); //每次读取一行 while (!reader.EndOfStream) { line = reader.ReadLine(); line += "\r\n" + line; richTxtInfo.AppendText(line); richTxtInfo.SelectionStart = richTxtInfo.Text.Length; richTxtInfo.ScrollToCaret(); } } p.WaitForExit(); pbT.Value = 80; pro.Value = 80; lb.Text = "80%"; curEvent.Text = channel + " 打包完成"; richTxtInfo.AppendText("\r\n" + curEvent.Text + "\r\n"); Process makeSign = new Process(); // 签名-调用命令行输出 //makeSign.StartInfo.UseShellExecute = false; //makeSign.StartInfo.CreateNoWindow = true; //makeSign.StartInfo.RedirectStandardInput = true; //makeSign.StartInfo.RedirectStandardOutput = true; //makeSign.StartInfo.RedirectStandardError = true; string signPwd = txtSignPwd.Text.ToString(); string keyStrorePwd = txtKeyPwd.Text.ToString(); string keyStore = lbPwdFile.Text.ToString(); string alias = txtAlias.Text.ToString(); string releasePath = envConfig.releasePkg + game + @"\"; if (!Directory.Exists(releasePath)) { Directory.CreateDirectory(releasePath); } string releaseApk = releasePath + game + "_" + compileApkName; // makeSign.StartInfo.FileName = envConfig.signPath + "jarsigner"; makeSign.StartInfo.FileName = "jarsigner"; // compileApk = @"C:\Users\win8\Desktop\123.apk"; makeSign.StartInfo.Arguments = " -digestalg SHA1 -sigalg MD5withRSA -verbose -keystore " + keyStore + " -storepass " + keyStrorePwd + " -keypass " + signPwd + " -signedjar " + releaseApk + " " + compileApk + " " + alias; Clipboard.SetText(makeSign.StartInfo.FileName + " " + makeSign.StartInfo.Arguments); // MessageBox.Show("beginSign"); makeSign.Start(); //reader = makeSign.StandardOutput;//截取输出流 //line = "\r\n"; //line = reader.ReadLine();//每次读取一行 //while (!reader.EndOfStream) //{ // line = reader.ReadLine(); // line += "\r\n" + line; // richTxtInfo.AppendText(line); // richTxtInfo.SelectionStart = richTxtInfo.Text.Length; // richTxtInfo.ScrollToCaret(); //} makeSign.WaitForExit(); pbT.Value = 100; pro.Value = 100; lb.Text = "100%"; curEvent.Text = channel + "签名完成"; richTxtInfo.AppendText("\r\n" + curEvent.Text + "\r\n"); //todo 加固 }
protected void ProcessConnect(Socket socket, object state, SocketAsyncEventArgs e, Exception exception) { if (exception != null) { m_InConnecting = false; OnError(exception); if (e != null) { e.Dispose(); } ConnectTimeout.Set(); return; } if (e != null && e.SocketError != SocketError.Success) { m_InConnecting = false; OnError(new SocketException((int)e.SocketError)); e.Dispose(); ConnectTimeout.Set(); return; } if (socket == null) { m_InConnecting = false; OnError(new SocketException((int)SocketError.ConnectionAborted)); ConnectTimeout.Set(); return; } //To walk around a MonoTouch's issue //one user reported in some cases the e.SocketError = SocketError.Succes but the socket is not connected in MonoTouch if (!socket.Connected) { m_InConnecting = false; ConnectTimeout.Set(); var socketError = SocketError.HostUnreachable; #if !SILVERLIGHT && !NETFX_CORE try { socketError = (SocketError)socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error); } catch (Exception ex) { socketError = SocketError.HostUnreachable; EE.LogError("GetSocketOption Error", ex, log); } #endif OnError(new SocketException((int)socketError)); return; } if (e == null) { e = new SocketAsyncEventArgs(); } e.Completed += SocketEventArgsCompleted; Client = socket; m_InConnecting = false; #if !SILVERLIGHT try { // mono may throw an exception here LocalEndPoint = socket.LocalEndPoint; } catch (Exception ex) { EE.LogError("Get socket.LocalEndPoint Error", ex, log); } #endif var finalRemoteEndPoint = e.RemoteEndPoint != null ? e.RemoteEndPoint : socket.RemoteEndPoint; if (string.IsNullOrEmpty(HostName)) { HostName = GetHostOfEndPoint(finalRemoteEndPoint); } else// connect with DnsEndPoint { var finalDnsEndPoint = finalRemoteEndPoint as DnsEndPoint; if (finalDnsEndPoint != null) { var hostName = finalDnsEndPoint.Host; if (!string.IsNullOrEmpty(hostName) && !HostName.Equals(hostName, StringComparison.OrdinalIgnoreCase)) { HostName = hostName; } } } #if !SILVERLIGHT && !NETFX_CORE try { //Set keep alive Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); //byte[] inValue = new byte[] { 1, 0, 0, 0, 0x20, 0x4e, 0, 0, 0xd0, 0x07, 0, 0 };// 首次探测时间20 秒, 间隔侦测时间2 秒 byte[] inValue = new byte[] { 1, 0, 0, 0, 0x88, 0x13, 0, 0, 0xd0, 0x07, 0, 0 };// 首次探测时间5 秒, 间隔侦测时间2 秒 Client.IOControl(IOControlCode.KeepAliveValues, inValue, null); } catch (Exception ex) { EE.LogError("SetSocketOption Error", ex, log); } ConnectTimeout.Set(); #endif OnGetSocket(e); }
static void Main(string[] args) { string str = EE.Name <EnumData>(x => x.DisplayMember); str = EE.Name <EnumData>(x => x.ValueMember); string UserInfoId1 = "84667fb5-4318-442f-99c7-243246c7c863"; var sqlCmd = MsGenerateSql.SelectFromTable <MenuInfo>(). LeftJoin <RoleMenuRelationship, MenuInfo>((t1, t2) => t1.MenuInfoId == t2.MenuInfoId). LeftJoin <RoleInfo, RoleMenuRelationship>((t1, t2) => t1.RoleInfoId == t2.RoleInfoId). LeftJoin <UserRoleRelationship, RoleInfo>((t1, t2) => t1.RoleInfoId == t2.RoleInfoId). LeftJoin <UserInfo, UserRoleRelationship>((t1, t2) => t1.UserInfoId == t2.UserInfoId).Distinct().Where <UserInfo>((t) => t.UserInfoId == UserInfoId1 && t.EmployeeNum == "101"); DateTime dt = DateTime.Parse("2019-07-01"); sqlCmd = MsGenerateSql.SelectFromTable <MaterialNumber>() .Where <MaterialNumber>((t) => t.ValidFrom > dt); EE.Name <MenuInfo>(t => t.MenuName); //MsGenerateSql.Name<MenuInfo>((t) => new object[] //{ // t.MenuName //}); string sql = sqlCmd.AutoMapDisplayItem <RoleInfo>().GenerateSql(); sql = sqlCmd.ManualMapDisplayItem(EE.NameSql <UserInfo>(t => new object[] { t.EmployeeNum, t.EmployeeName, t.Mobile, t.Email })).GenerateSql(); return; //EnumAttribute.EnumToList<MaterialType>(); //LocalLanguage("zh-CN,原材料;en-US,RawMaterial"); //SystemBusiness _UserInfoBusiness = new SystemBusiness(); //List<MenuInfo> itemList = new List<MenuInfo>(); //itemList = _UserInfoBusiness.GetAllEntitys<MenuInfo>(); // LoginStatus status = _UserInfoBusiness.Login("101", "123"); //_UserInfoBusiness.GetMenusByUserId("84667fb5-4318-442f-99c7-243246c7c863"); ////List<QCItemType> itemQCNewNewList = new List<QCItemType>(); ////List<MaterialNumber> mnUpdateList = new List<MaterialNumber>(); ////DateTime dt = DateTime.Now; ////MaterialNumber mn = mnd.GetEntityById(mnList.FirstOrDefault().MaterialNumberId); ////MaterialNumber itemMNU = ObjectHelper.DeepClone<MaterialNumber>(mn); ////MaterialNumber itemMNNew = ObjectHelper.DeepClone<MaterialNumber>(mn); ////itemMNU.MaterialName = mn.MaterialName + "更新"; ////mnUpdateList.Add(itemMNU); ////itemMNNew.MaterialNumberId = Guid.NewGuid().ToString(); ////itemMNNew.MaterialNum = mn.MaterialNum + "新建"; ////itemMNNew.MaterialName = mn.MaterialName + "新建"; ////mnUpdateList.Add(itemMNNew); //string path = @"C:\Users\koukou\Desktop\EMAS系统上线演示\基础数据\物料信息201922713399.xls"; //if(mnd.ImportBaseDataFromFile(path, "物料信息")) //{ // Console.Write("数据导入成功!"); //} //ProductionBusiness pb = new ProductionBusiness(); //path = @"C:\Users\koukou\Desktop\EMAS系统上线演示\基础数据\客户物料信息关联20192281579.xls"; //if (pb.ImportBaseDataFromFile(path, "客户物料信息关联")) //{ // Console.Write("数据导入成功!"); //} ////if(mnd.SaveBaseData(mnUpdateList)) ////{ //// Console.Write("保存成功"); ////} //foreach (var item in mnList) //{ // //if (mnUpdateList.Count == 0) // //{ // // MaterialNumber itemMNNew = ObjectHelper.DeepClone<MaterialNumber>(mn); // // //MaterialNumber itemMNNew = new MaterialNumber(); // // itemMNNew.MaterialNumberId = itemMNNew.MaterialNumberId; // // itemMNNew.MaterialName = itemMNNew.MaterialName+"更新"; // // mnUpdateList.Add(itemMNNew); // // QCItemType itemQCNew = new QCItemType(); // // itemQCNew.QCItemTypeId = Guid.NewGuid().ToString(); // // int typecode = dt.Year + dt.Month + dt.Day + dt.Hour + dt.Minute + dt.Second + dt.Millisecond; // // itemQCNew.QCItemTypeCode = typecode.ToString(); // // itemQCNew.QCItemTypeName = "首件"; // // itemQCNewNewList.Add(itemQCNew); // // mnd.TransactionOPEntitys((cn, transaction) => // // { // // bool result = false; // // result = mnd.TransactionOPEntitysAdd<QCItemType>(cn, transaction, EOPType.Insert, itemQCNewNewList); // // result = mnd.TransactionOPEntitysAdd<MaterialNumber>(cn, transaction, EOPType.Update, mnUpdateList); // // return result; // // } // // ); // //} // //Console.WriteLine(mn.MaterialName); // } }
public EE.EvaluationResult MonoObjectToString(Thread thread, TargetStructObject obj, EE.EvaluationFlags flags, int timeout, out string text) { return(EE.MonoObjectToString(thread, obj, flags, timeout, out text)); }
protected void Button5_Click(object sender, EventArgs e) { checkcodition(); if (datacheck == 0) { gettingprocurementimportdata(); foreach (DataRow importprodata in DTG.Tables[0].Rows) { Getagentid = importprodata[1].ToString(); // prdate = importprodata[2].ToString(); string Convedate = importprodata[2].ToString(); string[] arrdate = Convedate.Split('-'); string dd = arrdate[0]; string MM = arrdate[1]; string yy = arrdate[2]; prdate = MM + "/" + dd + "/" + yy; GET = prdate.Split(' '); prdate = GET[0].ToString(); Sessions = importprodata[3].ToString(); FAT = Convert.ToDouble(importprodata[5]); SNF = Convert.ToDouble(importprodata[6]); PlantCode = importprodata[7].ToString(); Route_id = importprodata[8].ToString(); NoofCans = Convert.ToInt16(importprodata[9]); Milk_kg = Convert.ToDouble(importprodata[4]); string tempkg = Milk_kg.ToString("f2"); Milk_kg = Convert.ToDouble(tempkg); tmilkltr = (Milk_kg / 1.03).ToString("f2"); milkltr = Convert.ToDouble(tmilkltr); if (Milk_kg < 0) { Milk_kg = 0; milkltr = 0; } // @Clr=(((@Snf - 0.36) - (@Fat * 0.21)) * 4) Clr = Convert.ToDouble((((SNF - 0.36) - (FAT * 0.21)) * 4)); tclr = Clr.ToString("f2"); Clr = Convert.ToDouble(tclr); // Clr = importprodata[11].ToString(); Company_Code = importprodata[12].ToString(); Milk_Nature = importprodata[13].ToString(); if (Milk_Nature == "1") { MilkNature = "Cow"; } else { MilkNature = "Buffalo"; } SampleId = importprodata[14].ToString(); Sampleno = importprodata[15].ToString(); milk_tip_st_time = importprodata[16].ToString(); milk_tip_end_time = importprodata[17].ToString(); usr_weigher = importprodata[18].ToString(); usr_analizer = importprodata[19].ToString(); fat_kg = ((Milk_kg / 100) * FAT).ToString("f2"); snf_kg = ((Milk_kg / 100) * SNF).ToString("f2"); Truck_id = importprodata[22].ToString(); Status = importprodata[23].ToString(); ViewState["Getagentid"] = Getagentid.ToString(); ViewState["FAT"] = FAT.ToString(); ViewState["SNF"] = SNF.ToString(); getroutedetails(); if (countroute == 1) { } else { string insertroute; con = DB.GetConnection(); insertroute = "INSERT INTO route_Master(route_Id,route_Name,tot_Distance,added_date,status,Company_Code,Plant_Code,Lstatus) values ('" + Route_id + "' ,'" + "ROUTE-" + Route_id + "','" + 1 + "','" + System.DateTime.Now + "','" + 1 + "','" + ccode + "' ,'" + pcode + "','" + 1 + "')"; SqlCommand cmd = new SqlCommand(insertroute, con); } getagentdetails(); if (countagent == 1) { } else { string insertagnet; con = DB.GetConnection(); insertagnet = " INSERT INTO Agent_Master(Agent_Id,Agent_Name,Type,Cartage_Amt,Company_code,Plant_code,Route_id,Bank_Id,Payment_mode,Agent_AccountNo,AddedDate,phone_Number,Milk_Nature,Ifsc_code,SplBonus_Amt,agentratechartmode) values ('" + Getagentid + "','" + Getagentid + "','" + 0 + "','" + 0 + "','" + ccode + "','" + pcode + "','" + Route_id + "','" + 0 + "','CASH','" + 0 + "','" + 0 + "','" + Milk_Nature + "','" + 0 + "','" + 0 + ",'" + 0 + "')"; SqlCommand cmd = new SqlCommand(insertagnet, con); } gettingdatafromagentmaster(); COUNTI = COUNTI + 1; foreach (DataRow agentmaster in DTG.Tables[COUNTI].Rows) { cart = Convert.ToDouble(agentmaster[0]); nature = agentmaster[1].ToString(); splbonus = Convert.ToDouble(agentmaster[2]); //int agentchartmode = Convert.ToInt16(agentmaster[3]); //int dpuagent; //try //{ // // dpuagent = Convert.ToInt16(agentmaster[4]); //} //catch //{ // dpuagent = 0; //} cchartname = (agentmaster[5]).ToString(); //going to add filed chartname bchartname = (agentmaster[6]).ToString(); ViewState["cart"] = cart; ViewState["spbonus"] = splbonus; ViewState["nature"] = nature; ViewState["cowchartname"] = cchartname.ToString(); ViewState["buffchartname"] = bchartname.ToString(); } if ((MilkNature == "1") || (MilkNature == "Cow")) { gettingchartmaster(); } else { gettingchartmasterforbuff(); } charttype = DTG.Tables[COUNTI].Rows[rows][1].ToString(); minfat = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][2]); maxfat = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][3]); if ((MilkNature == "1") || (MilkNature == "Cow")) { bufftocowrate = 0; SnfCutting = 0; } else { bufftocowrate = Convert.ToDouble(DTG.Tables[COUNTI].Rows[1][4]); SnfCutting = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][5]); } NATURE = ViewState["nature"].ToString(); if (NATURE == "Cow") { if (charttype == "TS") { gettingTSratechart(); try { COUNTI = COUNTI + 1; RATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][0]); commission = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][1]); bonus = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][2]); RATE = RATE * (FAT + SNF); RATEE = RATE.ToString("F2"); RATE = Convert.ToDouble(RATEE); tempamount = (RATE * milkltr).ToString("F2"); if (RATE > 0) { amount = Convert.ToDouble(tempamount); } else { amount = 0; } } catch (Exception EE) { string GET45 = EE.ToString(); } } if (charttype == "SNF") { COUNTI = COUNTI + 1; gettingSNFratechart(); double TEMPRATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][0]); commission = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][1]); bonus = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][2]); double TEMPFAT = Convert.ToDouble(ViewState["FAT"]); double TEMPSNF = Convert.ToDouble(ViewState["SNF"]); RATE = TEMPRATE * (TEMPFAT + TEMPSNF); RATEE = RATE.ToString("F2"); RATE = Convert.ToDouble(RATEE); tempamount = (RATE * milkltr).ToString("F2"); if (RATE > 0) { amount = Convert.ToDouble(tempamount); } else { amount = 0; } } if (charttype == "FATSNF") { COUNTI = COUNTI + 1; gettingFATSNFratechart(); commission = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][1]); bonus = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][2]); double FRATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][0]); gettingFATSNFratechartrate(); COUNTI = COUNTI + 1; double SRATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][0]); double TEMPFATRATE = (FAT * FRATE); double TEMPSNFRATE = (SNF * SRATE); RATE = (TEMPFATRATE + TEMPSNFRATE); RATEE = RATE.ToString("F2"); RATE = Convert.ToDouble(RATEE); tempamount = (RATE * milkltr).ToString("F2"); if (RATE > 0) { amount = Convert.ToDouble(tempamount); } else { amount = 0; } } if (charttype == "FATSNFMIXED") { COUNTI = COUNTI + 1; gettingFATSNFMIXINGFAT(); COUNTI = COUNTI + 1; ViewState["FATSTATUS"] = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][0]); gettingFATSNFMIXINGSNF(); COUNTI = COUNTI + 1; RATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][0]); commission = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][1]); bonus = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][2]); commission = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][1]); bonus = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][2]); double TEMPRATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][0]); double TEMPFAT = Convert.ToDouble(ViewState["FAT"]); double TEMPSNF = Convert.ToDouble(ViewState["SNF"]); RATE = TEMPRATE * (TEMPFAT + TEMPSNF); tempamount = (RATE * milkltr).ToString("F2"); if (RATE > 0) { amount = Convert.ToDouble(tempamount); } else { amount = 0; } } CHARTID = ViewState["cowchartname"].ToString(); } if (NATURE == "Buffalo") { if (charttype == "FAT") { COUNTI = COUNTI + 1; gettingfatratechart(); RATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][0]); commission = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][1]); bonus = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][2]); CHARTID = ViewState["buffchartname"].ToString(); if (SnfCutting == 1) { snfcuttingplant(); COUNTI = COUNTI + 1; double tempcut = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][5]); RATE = RATE - tempcut; } else { RATE = (FAT * RATE); tempamount = (RATE * Milk_kg).ToString("F2"); amount = Convert.ToDouble(tempamount); } } if (FAT < bufftocowrate) { COUNTI = COUNTI + 1; gettingdatafromagentmasterBUFFTOCOW(); foreach (DataRow agentmaster in DTG.Tables[COUNTI].Rows) { cart = Convert.ToDouble(agentmaster[0]); nature = agentmaster[1].ToString(); splbonus = Convert.ToDouble(agentmaster[2]); //int agentchartmode = Convert.ToInt16(agentmaster[3]); //int dpuagent; //try //{ // // dpuagent = Convert.ToInt16(agentmaster[4]); //} //catch //{ // dpuagent = 0; //} cchartname = (agentmaster[5]).ToString(); //going to add filed chartname bchartname = (agentmaster[6]).ToString(); ViewState["cart"] = cart; ViewState["spbonus"] = splbonus; ViewState["nature"] = nature; ViewState["cowchartname"] = cchartname.ToString(); ViewState["buffchartname"] = bchartname.ToString(); } gettingchartmasterBUFFTOCOW(); charttype = DTG.Tables[COUNTI].Rows[0][1].ToString(); minfat = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][2]); maxfat = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][3]); NATURE = ViewState["nature"].ToString(); if (charttype == "TS") { gettingTSratechartCOWBUFF(); COUNTI = COUNTI + 1; RATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][0]); commission = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][1]); bonus = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][2]); RATE = RATE * (FAT + SNF); RATEE = RATE.ToString("F2"); RATE = Convert.ToDouble(RATEE); tempamount = (RATE * Milk_kg).ToString("F2"); amount = Convert.ToDouble(tempamount); } if (charttype == "SNF") { COUNTI = COUNTI + 1; gettingSNFratechart(); double TEMPRATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][0]); commission = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][1]); bonus = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][2]); double TEMPFAT = Convert.ToDouble(ViewState["FAT"]); double TEMPSNF = Convert.ToDouble(ViewState["SNF"]); RATE = TEMPRATE * (TEMPFAT + TEMPSNF); RATEE = RATE.ToString("F2"); RATE = Convert.ToDouble(RATEE); tempamount = (RATE * Milk_kg).ToString("F2"); amount = Convert.ToDouble(tempamount); } if (charttype == "FATSNF") { COUNTI = COUNTI + 1; gettingFATSNFratechart(); gettingFATSNFratechartrate(); commission = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][1]); bonus = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][2]); double FRATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][0]); COUNTI = COUNTI + 1; double SRATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][0]); double TEMPFATRATE = (FAT * FRATE); double TEMPSNFRATE = (SNF * SRATE); RATE = (TEMPFATRATE + TEMPSNFRATE); RATEE = RATE.ToString("F2"); RATE = Convert.ToDouble(RATEE); tempamount = (RATE * Milk_kg).ToString("F2"); amount = Convert.ToDouble(tempamount); } if (charttype == "FATSNFMIXED") { COUNTI = COUNTI + 1; gettingFATSNFMIXINGFAT(); ViewState["FATSTATUS"] = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][0]); gettingFATSNFMIXINGSNF(); COUNTI = COUNTI + 1; RATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][0]); commission = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][1]); bonus = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][2]); commission = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][1]); bonus = Convert.ToDouble(DTG.Tables[COUNTI].Rows[rows][2]); double TEMPRATE = Convert.ToDouble(DTG.Tables[COUNTI].Rows[0][0]); double TEMPFAT = Convert.ToDouble(ViewState["FAT"]); double TEMPSNF = Convert.ToDouble(ViewState["SNF"]); RATE = TEMPRATE * (TEMPFAT + TEMPSNF); tempamount = (RATE * Milk_kg).ToString("F2"); amount = Convert.ToDouble(tempamount); } CHARTID = ViewState["cowchartname"].ToString(); } //if (NATURE == "Buffalo") //{ // if (charttype == "FAT") // { // COUNTI = COUNTI + 1; // gettingfatratechart(); // RATE = Convert.ToDouble(DTG.Tables[9].Rows[rows][0]); // commission = Convert.ToDouble(DTG.Tables[9].Rows[rows][1]); // bonus = Convert.ToDouble(DTG.Tables[9].Rows[rows][2]); // CHARTID = ViewState["buffchartname"].ToString(); // tempamount = (RATE * Milk_kg).ToString("F2"); // amount = Convert.ToDouble(tempamount); // } //} } if (NATURE == "Cow") { if ((commission < 0.20) && (commission > 0)) { double TEMPFAT = Convert.ToDouble(ViewState["FAT"]); templtr = milkltr; double mkg = templtr * 1.03; calcommission = (RATE * commission) * templtr; } if ((commission >= 0.20) && (commission > 0)) { double TEMPFAT = Convert.ToDouble(ViewState["FAT"]); templtr = milkltr;; double mkg = templtr * 1.03; calcommission = (commission * templtr); } calbonus = bonus * templtr; } else { if ((commission < 0.20) && (commission > 0)) { double TEMPFAT = Convert.ToDouble(ViewState["FAT"]); templtr = milkltr; double mkg = templtr * 1.03; calcommission = (TEMPFAT * commission) * mkg; } if ((commission >= 0.20) && (commission > 0)) { double TEMPFAT = Convert.ToDouble(ViewState["FAT"]); templtr = milkltr; double mkg = templtr * 1.03; calcommission = (commission * mkg); } calbonus = bonus * templtr; } string TEMPCOMM; double getcart; double spbonus; string temprate; if (FAT >= minfat && SNF >= maxfat) { TEMPCOMM = calcommission.ToString("F2"); calcommission = Convert.ToDouble(TEMPCOMM); getcart = Convert.ToDouble(ViewState["cart"]); spbonus = Convert.ToDouble(ViewState["spbonus"]); calcart = getcart * milkltr; calspl = spbonus * milkltr; temprate = (RATE).ToString("f2"); RATE = Convert.ToDouble(temprate); if (RATE > 0) { amount = Convert.ToDouble(tempamount); } else { amount = 0; } } else { TEMPCOMM = "0"; calcommission = 0; getcart = 0; spbonus = 0; calcart = 0; calspl = 0; temprate = "0"; RATE = 0; amount = Convert.ToDouble(tempamount); } string finalinserting = " insert into procurement([Agent_id], [Prdate], [Sessions], [Milk_ltr], [Fat], [Snf], [Rate], [Amount], [Plant_Code], [Route_id], [NoofCans], [Milk_kg], [Clr], [Company_Code], [Ratechart_Id], [Milk_Nature], [ComRate], [SampleId], [Sampleno], [milk_tip_st_time], [milk_tip_end_time], [usr_weigher], [usr_analizer], [fat_kg], [snf_kg], [Truck_id],[Status],[CartageAmount],[SplBonusAmount],[RateStatus])values('" + Getagentid + "','" + prdate + "','" + Sessions + "','" + milkltr + "','" + FAT + "','" + SNF + "' ,'" + RATE + "','" + amount + "','" + pcode + "','" + Route_id + "','" + NoofCans + "','" + Milk_kg + "','" + Clr + "','" + ccode + "','" + CHARTID + "','" + Milk_Nature + "','" + calcommission + "','" + SampleId + "','" + SampleId + "','" + milk_tip_st_time + "','" + milk_tip_end_time + "','" + usr_weigher + "','" + usr_analizer + "','" + fat_kg + "','" + snf_kg + "','" + Truck_id + "','" + 0 + "','" + calcart + "','" + calspl + "',' " + ' ' + "')"; SqlCommand cmd143 = new SqlCommand(finalinserting, con); cmd143.ExecuteNonQuery(); COUNTI = 0; // rows = rows + 1; calcommission = 0; DTG.Tables.Clear(); } procurementimport(); if (procimport == procurement) { Response.Write("<script language='javascript'>alert('" + Server.HtmlEncode(MESS.save) + "')</script>"); } else { DateTime dt1 = new DateTime(); dt1 = DateTime.ParseExact(txt_FromDate.Text, "dd/MM/yyyy", null); //dt2 = DateTime.ParseExact(txt_ToDate.Text, "dd/MM/yyyy", null); string d1 = dt1.ToString("MM/dd/yyyy"); string delete; delete = "delete from procurement where plant_code='" + pcode + "' and prdate='" + d1 + "' AND Sessions='" + ddl_shift.SelectedItem.Text + "' "; con = DB.GetConnection(); SqlCommand cmd = new SqlCommand(delete, con); cmd.ExecuteNonQuery(); Response.Write("<script language='javascript'>alert('" + Server.HtmlEncode(MESS.Check) + "')</script>"); } } else { Response.Write("<script language='javascript'>alert('" + Server.HtmlEncode(MESS.Check) + "')</script>"); } }
public void OnCallEvent <C>(T e, C calling) { EE?.Invoke(calling, e); }
public EE.EvaluationResult GetProperty(Thread thread, TargetPropertyInfo property, TargetStructObject instance, EE.EvaluationFlags flags, int timeout, out string error, out TargetObject value) { return(EE.GetProperty(thread, property, instance, flags, timeout, out error, out value)); }
//rawWord == 63;01330791 00 a 01 known 0 011 ^ 00026869 a 0000 ^ 00940237 a 0000 ^ 01091172 a 0000 ! 01332421 a 0101 & 01331163 a 0000 & 01331306 a 0000 & 01331448 a 0000 & 01331735 a 0000 & 01331882 a 0000 & 01332049 a 0000 & 01332232 a 0000 | apprehended with certainty; \"a known quantity\"; \"the limits of the known world\"; \"a musician known throughout the world\"; \"a known criminal\" " void Fill(string rawCard) { if (m_IsFilled) { return; } if (string.IsNullOrEmpty(rawCard)) { return; } int _iCoountUsing = rawCard.IndexOf(';'); if (_iCoountUsing != -1) { string coountUsingString = rawCard.Substring(0, _iCoountUsing); if (int.TryParse(coountUsingString, out m_CountOfUsage)) { rawCard = rawCard.Substring(_iCoountUsing + 1); } } string[] vals = rawCard.Split('|'); string[] links = vals[0].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); #region I - word if (!int.TryParse(links[0], out this.m_ID)) { throw new ApplicationException(string.Format("'{0}' is not valid format for id.", links[0])); } this.m_PartSpeech = (EE)links[2][0]; string _TempWord = links[4]; this.m_Synonyms = _TempWord; // в первом узле это равно == RootWord #region links List <string> forDoubleLinks = new List <string> { }; // избежим дублирования карточек for (int i = 5; i < links.Length; ++i) { string s = links[i]; int id; if (s.Length == 8 && int.TryParse(s, out id)) { EE _partSpeech = (EE)links[i + 1][0]; string tie = links[i - 1]; string idForDoubleLinks = id + _partSpeech + tie; if (forDoubleLinks.IndexOf(idForDoubleLinks) == -1) { forDoubleLinks.Add(idForDoubleLinks); if (Tie.Types.Contains(tie)) { tie = (string)Tie.Types[tie]; } Card card = new Card(this.RootWord, id, _partSpeech); // , tie); Childs.Add(card, tie); // TODO: избежим зациклиности в дереве а может зациклиность это и правильно //if (card.ID == this.ID) // Console.WriteLine("acyclicity"); } ++i; } // 00004711 02 r 05 merely 0 simply 0 just 0 only 2 but 1 002 \\ 01734801 a 0203 else if (s.Length != 1 && D.IsLetter(s[0])) { this.m_Synonyms += ", " + s; } } #endregion this.m_Synonyms = this.m_Synonyms.Replace('_', ' '); #endregion #region II - Meanings & examples if (vals.Length > 1) { string[] examples = vals[1].Split(';'); int meaningCount = 0; foreach (string val in examples) { if (val.Trim().StartsWith("\"")) { break; } else { ++meaningCount; } } this.m_Meanings = new string[meaningCount]; for (int i = 0; i < meaningCount; ++i) { this.m_Meanings[i] = examples[i].Trim(); } this.m_Examples = new string[examples.Length - meaningCount]; if (examples.Length > meaningCount) // если имеем примеры { string _BoldText = this.RootWord; // string.IsNullOrEmpty(this.RootWord) ? this.Word : this.RootWord; for (int i = 0; i < examples.Length - meaningCount; ++i) { string _exm = examples[i + meaningCount].Trim(' '); if (_exm.Trim('"').IndexOf('"') > -1) // isCitation { _exm = _exm.Replace('"', '\''); } else { _exm = _exm.Trim('"'); } ExamplesClearText.Add(_exm); // вставляем пробел между кавычками string _val = examples[i + meaningCount].Replace("\"", " \" ").Trim(); // выделяем пример если он содержит _rootWord if (_val.IndexOf(_BoldText) != -1) // " Test пример с заглавной буквы " и test не совместимы { _val = _val.Replace(_BoldText, "<b>" + _BoldText + "</b>"); } //_val = _val.ToUpper(); this.m_Examples[i] = _val; } } } #endregion m_IsFilled = true; }
/// <summary> /// Validates VAT number /// </summary> /// <returns>Corrected VAT number in VatNumber object</returns> public static VatNumber Validate(string vat, EUCountry euCountry) { string countryCode = euCountry.ToString().ToUpper(); vat = vat.ToUpper(); CountryBase countryBase; switch (euCountry) { case EUCountry.AT: countryBase = new AT(); break; case EUCountry.BE: countryBase = new BE(); break; case EUCountry.BG: countryBase = new BG(); break; case EUCountry.CY: countryBase = new CY(); break; case EUCountry.CZ: countryBase = new CZ(); break; case EUCountry.DE: countryBase = new DE(); break; case EUCountry.DK: countryBase = new DK(); break; case EUCountry.EE: countryBase = new EE(); break; case EUCountry.EL: countryBase = new EL(); break; case EUCountry.ES: countryBase = new ES(); break; case EUCountry.FI: countryBase = new FI(); break; case EUCountry.FR: countryBase = new FR(); break; case EUCountry.GB: countryBase = new GB(); break; case EUCountry.HR: countryBase = new HR(); break; case EUCountry.HU: countryBase = new HU(); break; case EUCountry.IE: countryBase = new IE(); break; case EUCountry.IT: countryBase = new IT(); break; case EUCountry.LT: countryBase = new LT(); break; case EUCountry.LU: countryBase = new LU(); break; case EUCountry.LV: countryBase = new LV(); break; case EUCountry.MT: countryBase = new MT(); break; case EUCountry.NL: countryBase = new NL(); break; case EUCountry.PL: countryBase = new PL(); break; case EUCountry.PT: countryBase = new PT(); break; case EUCountry.RO: countryBase = new RO(); break; case EUCountry.SE: countryBase = new SE(); break; case EUCountry.SI: countryBase = new SI(); break; case EUCountry.SK: countryBase = new SK(); break; default: throw new InvalidCountryException(); } if (countryBase.StripLetters) { return(new VatNumber(euCountry, countryBase.Validate(Strip(vat)))); } return(new VatNumber(euCountry, countryBase.Validate(StripNoLetters(vat, countryCode)))); }
public static List <ClassWorkPlan> CreateClassWorkPlans(ProductionOrderVersion item, List <ProductionMakeWorkOrderView> workList) { List <ClassWorkPlan> cwpList = new List <ClassWorkPlan>(); string ProductionVersionId = item.ProductionVersionId; DateTime dt = BaseEntityFac.GetServerTime(); //工序时间缓存 List <ProductionMakeWorkOrderTime> procesTimeList = new List <ProductionMakeWorkOrderTime>(); //获取该生产版本中工序在制品清单 List <WorkOrderOutProduct> woopList = BaseEntityFac.GetEntityByField <WorkOrderOutProduct>(x => x.ProductionVersionId == ProductionVersionId); //跟工序作业顺序计算 升序 List <ProductionMakeWorkOrderView> newworkList = workList.OrderBy(x => x.ProcessOrder).ToList(); //公式 (订单量/产能)* (时间值)*(时间单位换算成的秒数) decimal totalWorkTime = (item.MakeQty / item.ProductMakeValue) * item.ProductMakeTimeValue * item.ProductMakeUnit;//作业时间 单位秒 //最晚作业开始时间 List <APSCalendar> ascList = GetAPSCalendarWorkDate(CalendarHelper.ALLResourceCode.ToString()); DateTime LatestStartTime = CalendarHelper.GetAPSWorkTime(item.ProductionOrderEndDate, totalWorkTime, ascList); //获取工序时间(去掉非作业时间) List <ProductionMakeWorkOrderTime> tempprocesTimeList = CalculationProcessTime(item, newworkList, woopList, LatestStartTime, dt, ascList); if (tempprocesTimeList == null) { return(null); } foreach (var pmw in newworkList) { //获取工序产出品 可能存在一个工序多个产出品的情况 List <WorkOrderOutProduct> newwoopList = woopList.FindAll(x => x.WorkOrderNum == pmw.WorkOrderNum && x.ProductionVersionId == pmw.ProductionVersionId); if (newwoopList != null && newwoopList.Count > 0) { ProductionMakeWorkOrderTime processTime = tempprocesTimeList.Find(x => x.ProductionMakeWorkOrderId == pmw.ProductionMakeWorkOrderId); foreach (var woopItem in newwoopList) { ClassWorkPlan cwp = new ClassWorkPlan(); cwp.ClassWorkPlanId = Guid.NewGuid().ToString(); cwp.ProductionOrderNumbe = item.ProductionOrderNumbe; //生产订单编号 cwp.ProductionOrderVersionNumber = item.ProductionOrderVersionNumber; //订单工艺编号 cwp.CustomerNum = item.CustomerNum; cwp.CustomerName = item.CustomerName; cwp.WorkPlanNo = dt.Year.ToString() + BaseEntityFac.GetNewSerialNumber(EE.Name <ClassWorkPlan>(x => x.WorkPlanNo)); //工单流水号 cwp.TaskSheetType = (int)TaskSheetType.PS; //工单大分类 cwp.FatherWorkPlanNo = string.Empty; //父级工单流水号 cwp.ProductionVersionId = pmw.ProductionVersionId; //生产版本ID cwp.ProductionVersionName = pmw.ProductionVersionName; //生产版本名称 cwp.ProductionMakeWorkOrderId = pmw.ProductionMakeWorkOrderId; //生产版本中工序ID cwp.WorkOrderOutProductId = woopItem.WorkOrderOutProductId; //工序在制品ID cwp.WorkOrderPositionId = string.Empty; //工序中工位ID cwp.WorkOrderNum = pmw.WorkOrderNum; //工序编码 cwp.WorkOrderName = pmw.WorkOrderName; //工序名称 cwp.MaterialNum = woopItem.MaterialNum; //在制品编码 cwp.MaterialName = woopItem.MaterialName; //在制品名称 cwp.BatchNumber = item.BatchNumber; //生产批次 cwp.MainProductionResourceCode = string.Empty; //主资源编码 cwp.MainProductionResourceName = string.Empty; //主资源名称 cwp.SubProductionResourceCode = string.Empty; //副资源编码 cwp.SubProductionResourceName = string.Empty; //副资源名称 cwp.WorkPositionNum = string.Empty; //工位编码 cwp.WorkPositionName = string.Empty; //工位名称 cwp.EmployeeNum = string.Empty; //员工工号 cwp.PlanWorkDate = dt; //计划日期 cwp.ClassNoName = string.Empty; //班次 cwp.EarliestStartTime = processTime.EarliestStartTime; cwp.LatestEndTime = processTime.LatestEndTime; cwp.PlanWorkStartTime = cwp.EarliestStartTime; cwp.PlanWorkEndTime = cwp.LatestEndTime; cwp.ClassPlanQty = item.MakeQty * woopItem.Qty - InspectRegisterQty(item.ProductionOrderNumbe, woopItem.WorkOrderOutProductId); //工单计划作业量 去掉库存抵消量 cwp.ClassRealQty = 0; //工单实际作业量 cwp.ClassSubmitScrapQty = 0; //报工后出现的废品 cwp.ClassNoSubmitScrapQty = 0; //调试出现的废品 cwp.UnitCode = item.UnitCode; //物料单位 cwp.TaskSheetSmallType = (int)TaskSheetSmallType.Normal; //工单小分类 cwp.IsPublish = (int)WhetherValue.No; cwp.CustomFlag = 0; //1-表示插单 cwp.TaskSheetOPStatus = (int)TaskSheetOPStatus.NotStart; //工单操作 cwp.HandoverState = (int)WhetherValue.No; //交接班 cwp.QCProcessType = woopItem.QCProcessType; //质检类型 例如全检 抽检 免检 cwp.QCProcessFlag = (int)QCProcessFlag.Untested; //质检状态 cwp.QCEmployeeName = string.Empty; //质检员姓名 cwp.QCEmployeeNum = string.Empty; //质检员工号 cwp.Comments = string.Empty; //工单备注 cwpList.Add(cwp); } } } return(cwpList); }
// Util func. public static void AddEvent(Action <object> action) { EE.On(nameof(action), action); }