public string UserAuthentication(string login_mail, string login_password, string devid, string sk) { string[,] p = new string[2, 3]; p[0, 0] = "login_mail"; p[1, 0] = login_mail; p[0, 1] = "login_password"; p[1, 1] = login_password; p[0, 2] = "devid"; p[1, 2] = devid; devid = SEC.SECURITY_ContentDecrypt(devid); if (!SEC.SECURITY_RequestDecrypt(p, sk, devid)) { return(SEC.SECURITY_ContentEncrypt("-4")); } login_mail = SEC.SECURITY_ContentDecrypt(login_mail); string query = "select HCCU_ID from HCCU_FACT WHERE HCCU_UID='" + login_mail + "' AND SUBSTRING(HCCU_PSW,4,LEN(HCCU_PSW)-7)=SUBSTRING('" + login_password + "',4,LEN('" + login_password + "')-7)"; try { string ret0 = DataHelperForDevService.Query_ExecuteScalar(DataHelperForDevService.DataBaseFact.CENTRAL, query, null); return(SEC.SECURITY_ContentEncrypt(ret0)); // return -2 if the input para equals null. } catch { return(SEC.SECURITY_ContentEncrypt("0")); } }
public string UserAuthenticationWithLocalIPVarify(string login_id, string login_password, string devid, string sk) { string[,] p = new string[2, 3]; p[0, 0] = "login_id"; p[1, 0] = login_id; p[0, 1] = "login_password"; p[1, 1] = login_password; p[0, 2] = "devid"; p[1, 2] = devid; devid = SEC.SECURITY_ContentDecrypt(devid); if (!SEC.SECURITY_RequestDecrypt(p, sk, devid)) { return(SEC.SECURITY_ContentEncrypt("-4")); } login_id = SEC.SECURITY_ContentDecrypt(login_id); string query = "select HCCU_ID from HCCU_FACT WHERE HCCU_UID='" + login_id + "' AND HCCU_PSW = '" + login_password + "'"; try { string ret0 = DataHelperForDevService.Query_ExecuteScalar(DataHelperForDevService.DataBaseFact.CENTRAL, query, null); string query2 = "select ip from v_hccu where hccu_id='" + ret0 + "'"; string ret1 = DataHelperForDevService.Query_ExecuteScalar(DataHelperForDevService.DataBaseFact.CENTRAL, query2, null); return(SEC.SECURITY_ContentEncrypt(ret0 + "|" + ret1)); } catch { return(SEC.SECURITY_ContentEncrypt("0")); } }
public string AddEPCategory(string categoryname, string categorydesp, string cosid, string devid, string sk) { string[,] p = new string[2, 4]; p[0, 0] = "categoryname"; p[1, 0] = categoryname; p[0, 1] = "categorydesp"; p[1, 1] = categorydesp; p[0, 2] = "cosid"; p[1, 2] = cosid; p[0, 3] = "devid"; p[1, 3] = devid; devid = SEC.SECURITY_ContentDecrypt(devid); if (!SEC.SECURITY_RequestDecrypt(p, sk, devid)) { return(SEC.SECURITY_ContentEncrypt("-4")); } categoryname = SEC.SECURITY_ContentDecrypt(categoryname); categorydesp = SEC.SECURITY_ContentDecrypt(categorydesp); cosid = SEC.SECURITY_ContentDecrypt(cosid); COS_WEBSERVICE_EPTYPE c = new COS_WEBSERVICE_EPTYPE(); return(SEC.SECURITY_ContentEncrypt(c.EPTYPE_Add(categoryname, categorydesp, cosid).ToString())); }
private void Button_Click_2(object sender, RoutedEventArgs e) { try { sec = db.SECs .FirstOrDefault(p => p.id == sec.id); sec.phone = Convert.ToInt64(tb_phone.Text); db.SaveChanges(); if (list.SelectedIndex != -1) { var pav = db.Pavilions .Where(p => p.SEC == sec.id); int[] mas = new int[pav.Count()]; int i = 0; foreach (var p in pav) { mas[i] = p.id; i++; } var tmp = mas[list.SelectedIndex]; var pa = db.Pavilions .Where(p => p.id == tmp) .FirstOrDefault(); pa.number = Convert.ToInt32(tb_pav.Text); pa.name = tb_p_n.Text; pa.comments = tb_p_o.Text; db.SaveChanges(); updatePavilion(); } } catch (Exception a) { System.Windows.MessageBox.Show(a.Message); } }
public string GetHCCUNetworkInfo(string devid, string sk) { string[,] p = new string[2, 1]; p[0, 0] = "devid"; p[1, 0] = devid; devid = SEC.SECURITY_ContentDecrypt(devid); if (!SEC.SECURITY_RequestDecrypt(p, sk, devid)) { return(SEC.SECURITY_ContentEncrypt("-4")); } string query = "select * from hccu_mac_fact where hccu_id='" + devid + "'"; DataTable dt = DataHelperForDevService.Query_SqlDataAdapter(DataHelperForDevService.DataBaseFact.CENTRAL, query, null); if (dt.Rows.Count == 0) { return(SEC.SECURITY_ContentEncrypt("0")); } else { string returns = ""; for (int x = 0; x < dt.Rows.Count; x++) { returns += dt.Rows[0]["IP"].ToString() + "," + dt.Rows[0]["PORT"].ToString() + "|"; } return(SEC.SECURITY_ContentEncrypt(returns)); } }
public static IntPtr CreateFileMapping(PAGE pageProtect, SEC secProtect, uint dwMaximumSizeHigh, uint dwMaximumSizeLow, string lpName) { // This is a messy function to wrap. // GetLastError returns ERROR_ALREADY_EXISTS if the mapping already exists, and the handle is returned. // not all PAGE and SEC combos are legit IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); // SafeFileHandle.Invalid? return _CreateFileMapping(INVALID_HANDLE_VALUE, IntPtr.Zero, (int)pageProtect | (int)secProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName); }
public string GetEPCategory(string para, string devid, string sk) { string[,] p = new string[2, 2]; p[0, 0] = "para"; p[1, 0] = para; p[0, 1] = "devid"; p[1, 1] = devid; devid = SEC.SECURITY_ContentDecrypt(devid); if (!SEC.SECURITY_RequestDecrypt(p, sk, devid)) { return(SEC.SECURITY_ContentEncrypt("-4")); } para = SEC.SECURITY_ContentDecrypt(para); if (para != "0") { string query = "select * from endpoint_type_fact where HCCU_ID='" + devid + "' and EP_TYPE_ID='" + para + "'"; DataTable dt = DataHelperForDevService.Query_SqlDataAdapter(DataHelperForDevService.DataBaseFact.CENTRAL, query, null); if (dt.Rows.Count == 0) { return(SEC.SECURITY_ContentEncrypt("0")); } string ret = ""; for (int x = 0; x < dt.Rows.Count; x++) { ret += dt.Rows[x]["EP_TYPE_ID"].ToString() + "," + dt.Rows[x]["EP_TYPE_NAME"].ToString() + "," + dt.Rows[x]["EP_TYPE_DESCRIPTION"].ToString() + "|"; } return(ret); } else { COS_WEBSERVICE_EPTYPE c = new COS_WEBSERVICE_EPTYPE(); ArrayList al = c.EPTYPE_GetList(devid); string ret = ""; if (al.Count == 0) { return(SEC.SECURITY_ContentEncrypt("0")); } for (int x = 0; x < al.Count; x++) { if (al[x].ToString().Trim() == "-1" || al[x].ToString().Trim() == "-2") { return(SEC.SECURITY_ContentEncrypt("-3")); } ret += al[x].ToString() + "|"; } return(ret); } }
public static IntPtr CreateFileMapping(PAGE pageProtect, SEC secProtect, uint dwMaximumSizeHigh, uint dwMaximumSizeLow, string lpName) { // This is a messy function to wrap. // GetLastError returns ERROR_ALREADY_EXISTS if the mapping already exists, and the handle is returned. // not all PAGE and SEC combos are legit IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); // SafeFileHandle.Invalid? return(_CreateFileMapping(INVALID_HANDLE_VALUE, IntPtr.Zero, (int)pageProtect | (int)secProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName)); }
public Users(Login.Us var) { InitializeComponent(); db.Database.Connection.ConnectionString = Connect.ConnectionString; l = var.login; sec = db.SECs .FirstOrDefault(p => p.login == l); var t = db.Types .FirstOrDefault(p => p.id == sec.type); type = t.name; login.Content = type + " " + sec.name; updateInfoSEC(); updatePavilion(); }
private void timer2_Tick(object sender, EventArgs e) { string hour, min, sec; hour = HOUR.ToString(); min = MIN.ToString(); sec = SEC.ToString(); if (hour.Length < 2 && int.Parse(hour) < 10) { hour = "0" + hour; } if (min.Length < 2 && int.Parse(min) < 10) { min = "0" + min; } if (sec.Length < 2 && int.Parse(sec) < 10) { sec = "0" + sec; } label2.Text = hour + ":" + min + ":" + sec; if (SEC != 0) { SEC--; } else if (MIN != 0) { MIN--; SEC = 59; } else { HOUR--; MIN = 59; } if (HOUR == 0 && MIN == 0 && SEC == 0) { label2.Text = "Время истекло!"; textBox1.Enabled = true; textBox2.Enabled = true; textBox3.Enabled = true; timer2.Stop(); } }
public string GetCurrentExecOrder(string para, string cosid, string devid, string sk) { string[,] p = new string[2, 3]; p[0, 0] = "para"; p[1, 0] = para; p[0, 1] = "cosid"; p[1, 1] = cosid; p[0, 2] = "devid"; p[1, 2] = devid; devid = SEC.SECURITY_ContentDecrypt(devid); if (!SEC.SECURITY_RequestDecrypt(p, sk, devid)) { return(SEC.SECURITY_ContentEncrypt("-4")); } para = SEC.SECURITY_ContentDecrypt(para); cosid = SEC.SECURITY_ContentDecrypt(cosid); string query0 = "select count(*) from endpoint_fact where hccu_id='" + cosid + "'"; string ret0 = DataHelperForDevService.Query_ExecuteScalar(DataHelperForDevService.DataBaseFact.CENTRAL, query0, null); if (ret0 == "0") { return(SEC.SECURITY_ContentEncrypt("-3")); } string query = "select * from exec_order where ep_id = '" + para + "'"; DataTable dt = DataHelperForDevService.Query_SqlDataAdapter(DataHelperForDevService.DataBaseFact.PROPERTY, query, null); if (dt.Rows.Count == 0) { return(SEC.SECURITY_ContentEncrypt("0")); } else { string ret = ""; for (int x = 0; x < dt.Rows.Count; x++) { ret += dt.Rows[x]["PROP"].ToString().Trim() + "," + dt.Rows[x]["VALUE"].ToString().Trim() + "," + dt.Rows[x]["ORDER_DATE"].ToString().Trim() + "," + dt.Rows[x]["IFSENT"].ToString().Trim() + "," + dt.Rows[x]["EXPIRE"].ToString().Trim() + "|"; } return(SEC.SECURITY_ContentEncrypt(ret)); } }
public string DeleteEndPoint(string para, string cosid, string devid, string sk) { string[,] p = new string[2, 3]; p[0, 0] = "para"; p[1, 0] = para; p[0, 1] = "cosid"; p[1, 1] = cosid; p[0, 2] = "devid"; p[1, 2] = devid; devid = SEC.SECURITY_ContentDecrypt(devid); if (!SEC.SECURITY_RequestDecrypt(p, sk, devid)) { return(SEC.SECURITY_ContentEncrypt("-4")); } para = SEC.SECURITY_ContentDecrypt(para); cosid = SEC.SECURITY_ContentDecrypt(cosid); string query = "select count(*) from ENDPOINT_FACT WHERE EP_ID='" + para + "' AND HCCU_ID = '" + cosid + "'"; string ret0 = DataHelperForDevService.Query_ExecuteScalar(DataHelperForDevService.DataBaseFact.CENTRAL, query, null); if (ret0 == "0") { return(SEC.SECURITY_ContentEncrypt("-2")); } string[,] pa = new string[2, 1]; pa[0, 0] = "EP_ID"; pa[1, 0] = para; string[,] op = new string[2, 1]; op[0, 0] = "RET"; op[1, 0] = DataHelperForDevService.OUTPUT_PARA_INT16; List <SqlParameter> ret = DataHelperForDevService.QueryWithSP_OUTPUT(DataHelperForDevService.DataBaseFact.CENTRAL, "EP_DELETE_SP", pa, op); if (((SqlParameter)ret[0]).Value.ToString().Trim() != "1") { return(SEC.SECURITY_ContentEncrypt("-3")); } return(SEC.SECURITY_ContentEncrypt("1")); }
private void load_plan_Click(object sender, RoutedEventArgs e) { OpenFileDialog fd = new OpenFileDialog(); fd.DefaultExt = ".jpg"; fd.Filter = "Изображение (*.BMP, *.JPG, *.GIF, *.PNG)|*.bmp; *.jpg; *.gif; *.png"; var result = fd.ShowDialog(); switch (result) { case DialogResult.OK: FileInfo fi = new FileInfo(fd.FileName); string ext = fi.Extension; FtpWebRequest reqFTP; // Учетная запись if (sec.format != null) { reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://hecklerk.online/plans" + sec.login + sec.format)); reqFTP.Credentials = new NetworkCredential("ftpplans", "CH5pjX5b"); reqFTP.KeepAlive = false; reqFTP.Method = WebRequestMethods.Ftp.DeleteFile; FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse(); } reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://hecklerk.online/plans" + sec.login + ext)); reqFTP.Credentials = new NetworkCredential("ftpplans", "CH5pjX5b"); reqFTP.KeepAlive = false; // Задаем команду на закачку reqFTP.Method = WebRequestMethods.Ftp.UploadFile; // Тип передачи файла reqFTP.UseBinary = true; // Сообщаем серверу о размере файла reqFTP.ContentLength = fi.Length; Task.Run(() => fileLoad(fi, reqFTP)); sec = db.SECs .FirstOrDefault(p => p.id == sec.id); sec.format = ext; db.SaveChanges(); updateInfoSEC(); break; case DialogResult.Cancel: default: break; } }
public string DeleteEPCategory(string para, string devid, string sk) { string[,] p = new string[2, 2]; p[0, 0] = "para"; p[1, 0] = para; p[0, 1] = "devid"; p[1, 1] = devid; devid = SEC.SECURITY_ContentDecrypt(devid); if (!SEC.SECURITY_RequestDecrypt(p, sk, devid)) { return(SEC.SECURITY_ContentEncrypt("-4")); } para = SEC.SECURITY_ContentDecrypt(para); string[,] pa = new string[2, 1]; pa[0, 0] = "EP_TYPEID"; pa[1, 0] = para; string[,] op = new string[2, 1]; op[0, 0] = "RET"; op[1, 0] = DataHelperForDevService.OUTPUT_PARA_INT16; List <SqlParameter> ret = DataHelperForDevService.QueryWithSP_OUTPUT(DataHelperForDevService.DataBaseFact.CENTRAL, "EPTYPE_DELETE_SP", pa, op); string retvalue = ((SqlParameter)ret[0]).Value.ToString().Trim(); if (retvalue == "1") { return(SEC.SECURITY_ContentEncrypt("1")); } else { return(SEC.SECURITY_ContentEncrypt("0")); } }
public string SyncEventMethods(string codecontent, string epid, string propertyname, string devid, string sk) { string[,] p = new string[2, 4]; p[0, 0] = "codecontent"; p[1, 0] = codecontent; p[0, 1] = "epid"; p[1, 1] = epid; p[0, 2] = "propertyname"; p[1, 2] = propertyname; p[0, 3] = "devid"; p[1, 3] = devid; devid = SEC.SECURITY_ContentDecrypt(devid); if (!SEC.SECURITY_RequestDecrypt(p, sk, devid)) { return(SEC.SECURITY_ContentEncrypt("-4")); } codecontent = SEC.SECURITY_ContentDecrypt(codecontent); propertyname = SEC.SECURITY_ContentDecrypt(propertyname); epid = SEC.SECURITY_ContentDecrypt(epid); ArrayList x = new ArrayList(); EventCompiler c = null; if (codecontent != "") { try { c = new EventCompiler(devid, epid, propertyname); x = c.GetProcess(codecontent); } catch { x = null; } } else { string query2 = "DELETE FROM EP_EVENTS_CODE WHERE EVENT_CODE_ID IN (SELECT CODEID FROM EP_EVENTS_FACT WHERE EP_ID = '" + epid + "' AND PROPERTYNAME = '" + propertyname + "');" + "DELETE FROM EP_EVENTS_FACT WHERE EP_ID = '" + epid + "' AND PROPERTYNAME = '" + propertyname + "'"; int ret2 = DataHelper_COSWEBIDE.Query_ExecuteNonQuery(DataHelper_COSWEBIDE.DataBaseFact.PROPERTY, query2, null); if (ret2 == 1) { return("0"); } else { return("-2"); } } try { if (x == null) { return("-1"); } } catch { } string query = "DELETE FROM EP_EVENTS_CODE WHERE EVENT_CODE_ID IN (SELECT CODEID FROM EP_EVENTS_FACT WHERE EP_ID = '" + epid + "' AND PROPERTYNAME = '" + propertyname + "');" + "DELETE FROM EP_EVENTS_FACT WHERE EP_ID = '" + epid + "' AND PROPERTYNAME = '" + propertyname + "'"; int ret = DataHelper_COSWEBIDE.Query_ExecuteNonQuery(DataHelper_COSWEBIDE.DataBaseFact.PROPERTY, query, null); if (ret == 1) { string ret2 = "0"; string q2 = "INSERT INTO EP_EVENTS_CODE (RAW_CODE) VALUES (N'" + codecontent.Replace("'", "''") + "'); SELECT SCOPE_IDENTITY();"; ret2 = DataHelper_COSWEBIDE.Query_ExecuteScalar(DataHelper_COSWEBIDE.DataBaseFact.PROPERTY, q2, null); for (int s = 0; s < x.Count; s++) { string q3 = "INSERT INTO EP_EVENTS_FACT (EP_ID,PROPERTYNAME,TRIGGERCONTENT,STATUS,CODEID) VALUES ('" + epid + "','" + propertyname + "',N'" + x[s].ToString().Replace("'", "''") + "','1','" + ret2 + "')"; DataHelper_COSWEBIDE.Query_ExecuteNonQuery(DataHelper_COSWEBIDE.DataBaseFact.PROPERTY, q3, null); } return("1"); } else { return("-2"); } }
private void Button_Click_2(object sender, RoutedEventArgs e) { try { if (b != 1) { int l = list1.SelectedIndex; int l2 = list2.SelectedIndex; if (list2.SelectedIndex != -1) { var pav = db.Pavilions .Where(p => p.SEC == list1.SelectedIndex + 1); int[] mas = new int[pav.Count()]; int i = 0; foreach (var p in pav) { mas[i] = p.id; i++; } var tmp = mas[list2.SelectedIndex]; var pa = db.Pavilions .Where(p => p.id == tmp) .FirstOrDefault(); pa.number = Convert.ToInt32(tb_pav.Text); pa.name = tb_p_n.Text; pa.comments = tb_p_o.Text; db.SaveChanges(); updatePavilion(); } if (list1.SelectedIndex != -1) { var sec = db.SECs .Join(db.Types, typeID => typeID.type, typeN => typeN.id, (typeID, typeN) => new { ID = typeID, N = typeN }) .Where(p => p.ID.id == list1.SelectedIndex + 1) .FirstOrDefault(); var s = sec; s.ID.inn = Convert.ToInt32(tb_inn.Text); s.ID.kpp = Convert.ToInt32(tb_kpp.Text); s.ID.name = tb_name.Text; foreach (var t in db.Types) { if (t.name == tb_type.Text) { s.ID.type = t.id; } } s.ID.phone = Convert.ToInt64(tb_phone.Text); s.ID.login = tb_login.Text; s.ID.pass = tb_pass.Text; db.SaveChanges(); UpdateSEC(); } list1.SelectedIndex = l; list2.SelectedIndex = l2; } else { if (tb_inn.Text != "" && tb_name.Text != "" && tb_type.Text != "" && tb_login.Text != "" && tb_pass.Text != "" && tb_phone.Text != "") { var t = db.Types .Where(ty => ty.name == tb_type.Text) .FirstOrDefault(); SEC s = new SEC { inn = Convert.ToInt32(tb_inn.Text), kpp = Convert.ToInt32(tb_kpp.Text), name = tb_name.Text, type = t.id, login = tb_login.Text, pass = tb_pass.Text, phone = Convert.ToInt64(tb_phone.Text) }; var sec = db.SECs; sec.Add(s); db.SaveChanges(); UpdateSEC(); l_state.Content = "Изменение"; list1.IsEnabled = true; list2.IsEnabled = true; b = 0; } } } catch (Exception a) { MessageBox.Show(a.Message); } }
public string this[string columnName] { get { string result = null; //if (columnName == "SOC2000") //{ // if (SOC2000 != null && SOC2000.ToString().Length > 8) // { // result = "SOC2000 exceeds maximum length (8 digits)."; // //SOC2000 = (int?)int.Parse(SOC2000.ToString().Substring(0, 8)); // } //} if (columnName == "SEC") { if (SEC != null && SEC.ToString().Length > 8) { result = "SEC exceeds maximum length (8 digits)."; //SEC = (int?)int.Parse(SEC.ToString().Substring(0, 8)); } } if (columnName == "TYPEYR") { if (TYPEYR != null && TYPEYR.ToString().Length > 8) { result = "TYPEYR exceeds maximum length (8 digits)."; //TYPEYR = (int?)int.Parse(TYPEYR.ToString().Substring(0, 8)); } //else if (!TYPEYR.HasValue) //{ // result = MessagesConstants.TYPEYR_ValidationMessage; //} } if (columnName == "MODESTUD") { if (MODESTUD != null && MODESTUD.ToString().Length > 8) { result = "MODESTUD exceeds maximum length (8 digits)."; //MODESTUD = (int?)int.Parse(MODESTUD.ToString().Substring(0, 8)); } //else if (!MODESTUD.HasValue) //{ // result = MessagesConstants.MODESTUD_ValidationMessage; //} } if (columnName == "FUNDLEV") { if (FUNDLEV != null && FUNDLEV.ToString().Length > 8) { result = "FUNDLEV exceeds maximum length (8 digits)."; //FUNDLEV = (int?)int.Parse(FUNDLEV.ToString().Substring(0, 8)); } //else if (!FUNDLEV.HasValue) //{ // result = MessagesConstants.FUNDLEV_ValidationMessage; //} } if (columnName == "FUNDCOMP") { if (FUNDCOMP != null && FUNDCOMP.ToString().Length > 8) { result = "FUNDCOMP exceeds maximum length (8 digits)."; //FUNDCOMP = (int?)int.Parse(FUNDCOMP.ToString().Substring(0, 8)); } //else if (!FUNDCOMP.HasValue) //{ // result = MessagesConstants.FUNDCOMP_ValidationMessage; //} } //if (columnName == "STULOAD") //{ // if (STULOAD != null && STULOAD.ToString().Length > 10) // { // result = "STULOAD exceeds maximum length (10 digits)."; // //STULOAD = (decimal?)decimal.Parse(STULOAD.ToString().Substring(0, 10)); // } //} //if (columnName == "YEARSTU") //{ // if (YEARSTU != null && YEARSTU.ToString().Length > 8) // { // result = "YEARSTU exceeds maximum length (8 digits)."; // //YEARSTU = (int?)int.Parse(YEARSTU.ToString().Substring(0, 8)); // } // //else if (!YEARSTU.HasValue) // //{ // // result = MessagesConstants.YEARSTU_ValidationMessage; // //} // } if (columnName == "MSTUFEE") { if (MSTUFEE != null && MSTUFEE.ToString().Length > 8) { result = "MSTUFEE exceeds maximum length (8 digits)."; //MSTUFEE = (int?)int.Parse(MSTUFEE.ToString().Substring(0, 8)); } //else if (!MSTUFEE.HasValue) //{ // result = MessagesConstants.MSTUFEE_ValidationMessage; //} } //if (columnName == "PCOLAB") //{ // if (PCOLAB != null && PCOLAB.ToString().Length > 10) // { // result = "PCOLAB exceeds maximum length (10 digits)."; // //PCOLAB = (decimal?)decimal.Parse(PCOLAB.ToString().Substring(0, 10)); // } //} if (columnName == "PCFLDCS") { if (PCFLDCS != null && PCFLDCS.ToString().Length > 10) { result = "PCFLDCS exceeds maximum length (10 digits)."; //PCFLDCS = (decimal?)decimal.Parse(PCFLDCS.ToString().Substring(0, 10)); } } //if (columnName == "PCSLDCS") //{ // if (PCSLDCS != null && PCSLDCS.ToString().Length > 10) // { // result = "PCSLDCS exceeds maximum length (10 digits)."; // //PCSLDCS = (decimal?)decimal.Parse(PCSLDCS.ToString().Substring(0, 10)); // } //} //if (columnName == "PCTLDCS") //{ // if (PCTLDCS != null && PCTLDCS.ToString().Length > 10) // { // result = "PCTLDCS exceeds maximum length (10 digits)."; // //PCTLDCS = (decimal?)decimal.Parse(PCTLDCS.ToString().Substring(0, 10)); // } //} if (columnName == "SPECFEE") { if (SPECFEE != null && SPECFEE.ToString().Length > 8) { result = "SPECFEE exceeds maximum length (8 digits)."; //SPECFEE = (int?)int.Parse(SPECFEE.ToString().Substring(0, 8)); } //else if (!SPECFEE.HasValue) //{ // result = MessagesConstants.SPECFEE_ValidationMessage; //} } //if (columnName == "NETFEE") //{ // if (NETFEE != null && NETFEE.ToString().Length > 8) // { // result = "NETFEE exceeds maximum length (8 digits)."; // //NETFEE = (int?)int.Parse(NETFEE.ToString().Substring(0, 8)); // } //} //if (columnName == "GROSSFEE") //{ // if (GROSSFEE != null && GROSSFEE.ToString().Length > 8) // { // result = "GROSSFEE exceeds maximum length (8 digits)."; // //GROSSFEE = (int?)int.Parse(GROSSFEE.ToString().Substring(0, 8)); // } //} if (columnName == "ELQ") { if (ELQ != null && ELQ.ToString().Length > 8) { result = "ELQ exceeds maximum length (8 digits)."; //ELQ = (int?)int.Parse(ELQ.ToString().Substring(0, 8)); } } return(result); } }
public string invoke(string epid, string method, string para, string devid, string sk) { string[,] p = new string[2, 4]; p[0, 0] = "epid"; p[1, 0] = epid; p[0, 1] = "method"; p[1, 1] = method; p[0, 2] = "para"; p[1, 2] = para; p[0, 3] = "devid"; p[1, 3] = devid; devid = SEC.SECURITY_ContentDecrypt(devid); if (!SEC.SECURITY_RequestDecrypt(p, sk, devid)) { return(SEC.SECURITY_ContentEncrypt("-4")); } epid = SEC.SECURITY_ContentDecrypt(epid); method = SEC.SECURITY_ContentDecrypt(method); para = SEC.SECURITY_ContentDecrypt(para); string query = "SELECT * FROM EP_PRODUCT_METHODS_FACT" + " WHERE EP_PRODUCT_ID" + " IN" + " (SELECT EP_PRODUCTID FROM ENDPOINT_FACT WHERE EP_ID = '" + epid + "') AND METHODNAME='" + method + "'"; DataTable dt = DataHelperForDevService.Query_SqlDataAdapter(DataHelperForDevService.DataBaseFact.CENTRAL, query, null); if (dt.Rows.Count == 0) { return(SEC.SECURITY_ContentEncrypt("0")); } string methodname = dt.Rows[0]["MethodName"].ToString(); string returnType = dt.Rows[0]["returntype"].ToString(); string paracollection = dt.Rows[0]["paracollection"].ToString(); string id = dt.Rows[0]["id"].ToString(); string sp_para = ""; string procedurename = "invokMethod_" + id; #region 确定双方参数数量 int paracollection_number = 0; int para_number = 0; try { if (paracollection.Trim() == "") { paracollection_number = 0; } if (paracollection.IndexOf(',') == -1) { paracollection_number = 1; } else { string[] s = paracollection.Split(','); paracollection_number = s.Length; } if (para.Trim() == "") { para_number = 0; } if (para.IndexOf(',') == -1) { para_number = 1; } else { string[] s = para.Split(','); para_number = s.Length; } } catch { } #endregion if (paracollection_number + 1 != para_number) { return(SEC.SECURITY_ContentEncrypt("-1")); } if (paracollection_number == 0) { sp_para += " @SESSIONINEPID = N'" + para + "' "; } else if (paracollection_number == 1) { sp_para += paracollection + "=N'" + para.Split(',')[0].ToString().Trim() + "', @SESSIONINEPID = N'" + para.Split(',')[1].ToString().Trim() + "' "; } else { string[] x = paracollection.Split(','); string[] y = para.Split(','); for (int j = 0; j < x.Length; j++) { sp_para += x[j].ToString().Trim() + "=" + y[j].ToString().Trim() + ", "; } sp_para += " @SESSIONINEPID = N'" + y[x.Length].ToString().Trim() + "' "; } if (returnType == "1") { sp_para += " ,@INVOKERETURN = @INVOKERETURN OUTPUT; SELECT @INVOKERETURN AS 'RET','1' AS 'STA'"; } else { sp_para += "; SELECT '0' AS 'RET', '1' AS 'STA'"; } string execquery = "DECLARE @INVOKERETURN NVARCHAR(500); EXEC " + procedurename + " " + sp_para; try { DataTable dts = DataHelperForDevService.Query_SqlDataAdapter(DataHelperForDevService.DataBaseFact.PROPERTY, execquery, null); if (dts == null) { return(SEC.SECURITY_ContentEncrypt("-3")); } if (dts.Rows.Count == 0) { return(SEC.SECURITY_ContentEncrypt("-3")); } else { return(SEC.SECURITY_ContentEncrypt(dts.Rows[0]["RET"].ToString() + "," + dts.Rows[0]["STA"].ToString())); } } catch { return(SEC.SECURITY_ContentEncrypt("-3")); } }
/// <summary> /// Converts the coordinates to fit the picture box pattern, as well as scale it. /// </summary> /// <param name="robot">Robot to be converted.</param> /// <returns>The converted robot.</returns> private SEC.Log.LogContent.FrameContent.Robot ConvertAndScale(SEC.Log.LogContent.FrameContent.Robot robot) { /** * The scale is done by dividing the coordinates by our scale, this is pretty standard. * The conversion is done by putting the coordinates of the robot in the top left corner, as well as the coordinates of the field as a whole. */ robot.SetX(Convert.ToInt32(((robot.GetX() - (DimensionsNotScaled.Robot / 2)) / SCALE) + (DimensionsScaled.PlayableWidth / 2) + DimensionsScaled.SpareArea)); robot.SetY(Convert.ToInt32(((robot.GetY() - (DimensionsNotScaled.Robot / 2)) / SCALE) + (DimensionsScaled.PlayableHeight / 2) + DimensionsScaled.SpareArea)); return robot; }
public string GetEndPoint(string para, string getendpointlistmode, string devid, string sk) { string[,] p = new string[2, 3]; p[0, 0] = "para"; p[1, 0] = para; p[0, 1] = "getendpointlistmode"; p[1, 1] = getendpointlistmode; p[0, 2] = "devid"; p[1, 2] = devid; devid = SEC.SECURITY_ContentDecrypt(devid); if (!SEC.SECURITY_RequestDecrypt(p, sk, devid)) { return(SEC.SECURITY_ContentEncrypt("-4")); } para = SEC.SECURITY_ContentDecrypt(para); getendpointlistmode = SEC.SECURITY_ContentDecrypt(getendpointlistmode); if (para.IndexOf('^') != -1 && para.IndexOf('#') != -1) { para = Decode_hc(para); } string query = ""; string ret = ""; if (getendpointlistmode == getendpointlistmodeenum.devid.ToString()) { query = "select * from endpoint_Fact where hccu_id='" + para + "'"; } else if (getendpointlistmode == getendpointlistmodeenum.epid.ToString()) { query = "select * from endpoint_Fact where ep_id='" + para + "'"; } else if (getendpointlistmode == getendpointlistmodeenum.epmodeid.ToString()) { query = "select * from endpoint_Fact where ep_productid='" + para + "'"; } else if (getendpointlistmode == getendpointlistmodeenum.epmodename.ToString()) { query = "select * from endpoint_Fact where ep_productid" + " in" + " (select ep_product_id from endpoint_product_fact where ep_product_name='" + para + "' and dev_id='" + devid + "')"; } else if (getendpointlistmode == getendpointlistmodeenum.epname.ToString()) { query = "select * from endpoint_Fact where ep_userdefined_alias='" + para + "' and hccu_id='" + devid + "'"; } DataTable dt = DataHelperForDevService.Query_SqlDataAdapter(DataHelperForDevService.DataBaseFact.CENTRAL, query, null); if (dt.Rows.Count == 0) { return(SEC.SECURITY_ContentEncrypt("0")); } for (int s = 0; s < dt.Rows.Count; s++) { ret += dt.Rows[0]["EP_ID"].ToString().Trim() + "," + dt.Rows[0]["EP_TYPEID"].ToString().Trim() + "," + Encode(dt.Rows[0]["EP_USERDEFINED_ALIAS"].ToString().Trim()) + "," + dt.Rows[0]["EP_PRODUCTID"].ToString().Trim() + "," + dt.Rows[0]["HCCU_ID"].ToString().Trim() + "," + dt.Rows[0]["EP_MAC_ID"].ToString().Trim() + "|"; } return(SEC.SECURITY_ContentEncrypt(ret)); }