public static string GetSPid(string folderBack) { string[] arr = folderBack.Split('/'); Acc_Account account = GAccount.GetAccountInfo(); int unitId = Convert.ToInt16(account.UnitID); string strPID = ""; string strYMD = DateTime.Now.ToString("yyMMdd"); string strSelPID = "select SPID, SPidNo from [" + arr[0] + "].." + arr[6] + " where DateRecord='" + strYMD + "'"; DataTable dtPMaxID = SQLBase.FillTable(strSelPID); int intNewID = 0; if (dtPMaxID == null) { return(strPID); } if (dtPMaxID.Rows.Count == 0) { string strInsertID = "insert into [" + arr[0] + "].." + arr[6] + " (SPID,SPidNo,DateRecord) values('P',0,'" + strYMD + "')"; SQLBase.ExecuteNonQuery(strInsertID); intNewID = 0; } else { intNewID = Convert.ToInt32(dtPMaxID.Rows[0]["SPidNo"]); } intNewID++; string strUpdateID = "update [" + arr[0] + "].." + arr[6] + " set SPidNo='" + intNewID + "' where DateRecord ='" + strYMD + "'"; SQLBase.ExecuteNonQuery(strUpdateID); strPID = dtPMaxID.Rows[0]["SPID"].ToString() + DateTime.Now.ToString("yyMMdd") + GFun.GetNum(unitId, 4) + GFun.GetNum(intNewID, 4); return(strPID); }
// public static System.Data.DataTable GetBasicContent() { Acc_Account account = GAccount.GetAccountInfo(); string strSql = "select distinct Type as SID,TypeDesc as Text from tk_ConfigContent where validate='v' "; DataTable dt = SQLBase.FillTable(strSql, "FlowMeterDBCnn"); return(dt); }
public static DataTable GetConfigCont(string Type) { Acc_Account account = GAccount.GetAccountInfo(); string strSql = "select SID,Text from tk_ConfigContent where Type = '" + Type + "' and Validate = 'v' and UnitID = '" + account.UnitID + "'"; DataTable dt = SQLBase.FillTable(strSql, "SupplyCnn"); return(dt); }
public static DataTable GetUser() { Acc_Account account = GAccount.GetAccountInfo(); string unitid = account.UnitID; string strSql = "select UserId,UserName,ExJob from [BJOI_UM]..UM_UserNew where DeptId = '" + unitid + "' and ExJob != ''"; DataTable dt = SQLBase.FillTable(strSql); return(dt); }
public static int InsertApproval(string PID, string RelevanceID, string webkey, string folderBack, ref string a_strErr) { int intInsertBas = 0; int intUpdateBas = 0; int intLog = 0; Acc_Account account = GAccount.GetAccountInfo(); string createUser = account.UserID.ToString(); SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open(); string[] arr = folderBack.Split('/'); // BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/10/52/tk_PID/54/tk_UserLog string strInsertBas = "insert into [" + arr[0] + "].." + arr[1] + " (PID,RelevanceID,ApprovalContent,CreateUser,CreateTime,Validate,State,Job,ApprovalPersons,ApprovalLevel,AppType)" + " select '" + PID + "','" + RelevanceID + "','" + webkey + "','" + createUser + "','" + DateTime.Now + "','v','0',Duty,UserId,[Level],AppType from [BJOI_UM]..UM_Examine where BuType = '" + webkey + "'"; string strUpdateBas = ""; if (arr[2].IndexOf("..") > 0) { strUpdateBas = "update " + arr[2] + " set State = '" + arr[5] + "' where " + arr[3] + " = '" + RelevanceID + "'"; } else { strUpdateBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[5] + "' where " + arr[3] + " = '" + RelevanceID + "'"; } string strInsertLog = "insert into [" + arr[0] + "].." + arr[8] + " values ('" + RelevanceID + "','提交" + webkey + "审批操作','提交" + webkey + "审批成功','" + DateTime.Now + "','" + account.UserName + "','" + webkey + "')"; try { if (strInsertBas != "") { intInsertBas = sqlTrans.ExecuteNonQuery(strInsertBas, CommandType.Text, null); } if (strUpdateBas != "") { intUpdateBas = sqlTrans.ExecuteNonQuery(strUpdateBas, CommandType.Text, null); } if (strInsertLog != "") { intLog = sqlTrans.ExecuteNonQuery(strInsertLog, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsertBas + intUpdateBas); }
// 确认新增小组 public static int InsertGroup(string text, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("AccountCnn"); string strSql = "select top 1 GroupID,DeptId from UM_Group where Validate='v' order by GroupID desc "; DataTable dt = SQLBase.FillTable(strSql, "AccountCnn"); int GroupID = 0; string DeptID = ""; if (dt.Rows.Count > 0) { GroupID = Convert.ToInt32(dt.Rows[0]["GroupID"].ToString()) + 1; DeptID = dt.Rows[0]["DeptId"].ToString(); } else { GroupID = 1; Acc_Account acc = GAccount.GetAccountInfo(); DeptID = acc.UnitID; } string strInsertOrder = "insert into UM_Group (GroupID,GroupName,DeptId,Validate) "; strInsertOrder += " values ('" + GroupID + "','" + text + "','" + DeptID + "','v') "; try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static Acc_Account ValidateUser(string a_strUserName, string a_strPwd) { string strError = ""; DataRow oRow = null; Acc_Account instAccount = new Acc_Account(); DataTable dt = GetAccount(a_strUserName, GAccount.SystemID, ref strError); if (dt != null && dt.Rows.Count > 0) { oRow = dt.Rows[0]; //instAccount.UserID = GFun.SafeToInt32(oRow[0]); //instAccount.UserName = GFun.SafeToString(oRow[1]); //instAccount.UnitID = GFun.SafeToString(oRow[2]); //instAccount.Rights = GFun.SafeToString(oRow[3]); //instAccount.UnitCode = GFun.SafeToString(oRow[4]); //instAccount.UnitName = GFun.SafeToString(oRow[5]); //instAccount.UnitBrief = GFun.SafeToString(oRow[6]); //instAccount.HigherUnitID = GFun.SafeToString(oRow[7]); //instAccount.Functions = GFun.SafeToString(oRow[8]); //instAccount.UserRole = GFun.SafeToString(oRow[9]); //instAccount.FunctionsCode = GFun.SafeToString(oRow[12]); //instAccount.BranchID = GFun.SafeToString(oRow[13]); //instAccount.BranchPCD = GFun.SafeToString(oRow[14]); //instAccount.BranchName = GFun.SafeToString(oRow[15]); instAccount.UserID = GFun.SafeToInt32(oRow[0]); instAccount.UserName = GFun.SafeToString(oRow[1]); instAccount.UnitID = GFun.SafeToString(oRow[2]); instAccount.Rights = GFun.SafeToString(oRow[3]); instAccount.UnitName = GFun.SafeToString(oRow[4]); instAccount.FunctionsCode = GFun.SafeToString(oRow[5]); instAccount.UserRole = GFun.SafeToString(oRow[6]); instAccount.UserMobile = GFun.SafeToString(oRow[7]); instAccount.RoleNames = GFun.SafeToString(oRow[8]); instAccount.Path = GFun.SafeToString(oRow[9]); instAccount.Exjob = GFun.SafeToString(oRow[10]); } return(instAccount); }
public static int InsertContent(string type, string text, ref string a_strErr) { int intInsert = 0; int intContent = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string XID = PreGetTaskNo(type); string strSql = "select SID,TypeDesc from tk_ConfigContent where Type='" + type + "'"; DataTable dt = SQLBase.FillTable(strSql, "SupplyCnn"); string SID = ""; string TypeDesc = ""; Acc_Account acc = GAccount.GetAccountInfo(); if (dt.Rows.Count > 0) { SID = dt.Rows[0]["SID"].ToString(); SID = SID.Substring(0, SID.Length - 1); SID = SID + (Convert.ToInt32(XID) - 1).ToString(); TypeDesc = dt.Rows[0]["TypeDesc"].ToString(); } string strInsertOrder = ""; string strConte = ""; //在此处判断 if (type == "BusinessDistribute") { strInsertOrder += "insert into tk_BusinessDistribute (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "BillingWay") { strInsertOrder += "insert into tk_ConfigBillWay (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "CPZLZXBZ") { strInsertOrder += "insert into tk_ConfigQualityStandard (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "Relation") { strInsertOrder += "insert into tk_ConfigReation (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "ScaleType") { strInsertOrder += "insert into tk_ConfigScalType (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else { strInsertOrder += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } if (strConte != "") { intContent = sqlTrans.ExecuteNonQuery(strConte, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert + intContent); }
public static Acc_Account GetAccountInfo(HttpContextBase httpContext) { String strLoginName; Acc_Account oGAccountInfo = null; IPrincipal user = httpContext.User; if (!user.Identity.IsAuthenticated) { return(null); } try { oGAccountInfo = (httpContext.Session[KEY_CACHEUSER]) as Acc_Account; } catch { } if (oGAccountInfo != null) { return(oGAccountInfo); } strLoginName = user.Identity.Name.Split('^')[0]; oGAccountInfo = new Acc_Account(); oGAccountInfo.LoginName = strLoginName; string strError = ""; DataRow oRow = null; DataTable dt = GetAccount(strLoginName, SystemID.ToString(), ref strError); //SQLBase.FillTable(strSql, AccountCnn); if (dt != null && dt.Rows.Count > 0) { oRow = dt.Rows[0]; //oGAccountInfo.UserID = GFun.SafeToInt32(oRow[0]); //oGAccountInfo.UserName = GFun.SafeToString(oRow[1]); //oGAccountInfo.UnitID = GFun.SafeToString(oRow[2]); //oGAccountInfo.Rights = GFun.SafeToString(oRow[3]); //oGAccountInfo.UnitCode = GFun.SafeToString(oRow[4]); //oGAccountInfo.UnitName = GFun.SafeToString(oRow[5]); //oGAccountInfo.UnitBrief = GFun.SafeToString(oRow[6]); //oGAccountInfo.HigherUnitID = GFun.SafeToString(oRow[7]); //oGAccountInfo.Functions = GFun.SafeToString(oRow[8]); //oGAccountInfo.UserRole = GFun.SafeToString(oRow[9]); oGAccountInfo.UserID = GFun.SafeToInt32(oRow[0]); oGAccountInfo.UserName = GFun.SafeToString(oRow[1]); oGAccountInfo.UnitID = GFun.SafeToString(oRow[2]); oGAccountInfo.Rights = GFun.SafeToString(oRow[3]); oGAccountInfo.UnitName = GFun.SafeToString(oRow[4]); oGAccountInfo.FunctionsCode = GFun.SafeToString(oRow[5]); oGAccountInfo.UserRole = GFun.SafeToString(oRow[6]); oGAccountInfo.UserMobile = GFun.SafeToString(oRow[7]); oGAccountInfo.RoleNames = GFun.SafeToString(oRow[8]); oGAccountInfo.Path = GFun.SafeToString(oRow[9]); oGAccountInfo.Exjob = GFun.SafeToString(oRow[10]); } //设置Session httpContext.Session[KEY_CACHEUSER] = oGAccountInfo; return(oGAccountInfo); }
public static int UpdatezhunchuApproval(string IsPass, string Opinion, string Remark, string PID, string webkey, string folderBack, string RelevanceID, ref string a_strErr) { int intInsertBas = 0; int intUpdateBas = 0; int intLog = 0; int intAllBas = 0; //string strstate = ""; //int intstate = 0; Acc_Account account = GAccount.GetAccountInfo(); string UserId = account.UserID.ToString(); string[] arr = folderBack.Split('/'); int state = 0; if (IsPass == "是") { state = 1; } else { state = -1; } //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/51/55/tk_PID/54/tk_UserLog //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/23/22/tk_PID/10/tk_UserLog //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/62/61/tk_PID/29/tk_UserLog 年度 //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/10/73/tk_PID/75/tk_UserLog 恢复供货 string strInsertBas = "update [" + arr[0] + "].." + arr[1] + " set ApprovalMan = '" + UserId + "',ApprovalTime = '" + DateTime.Now + "',IsPass = '******',Opinion = '" + Opinion + "'," + "Remark = '" + Remark + "',State = '" + state + "' where PID = '" + PID + "' and ApprovalPersons = '" + UserId + "'"; string strUpdateBas = ""; if (state == -1) { if (arr[2].IndexOf("..") > 0) { strUpdateBas = "update " + arr[2] + " set State = '" + arr[7] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[7] == "29") { strUpdateBas = "update " + arr[2] + " set nState = '" + arr[7] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[7] == "29") { strUpdateBas = "update " + arr[2] + " set nState = '" + arr[7] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else { strUpdateBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[7] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } } string strInsertLog = "insert into [" + arr[0] + "].." + arr[8] + " values ('" + RelevanceID + "','" + webkey + "审批操作','" + webkey + "审批操作成功','" + DateTime.Now + "','" + account.UserName + "','" + webkey + "审批')"; if (strInsertBas != "") { intInsertBas = SQLBase.ExecuteNonQuery(strInsertBas, CommandType.Text, null); } if (strUpdateBas != "") { intUpdateBas = SQLBase.ExecuteNonQuery(strUpdateBas, CommandType.Text, null); } if (strInsertLog != "") { intLog = SQLBase.ExecuteNonQuery(strInsertLog, "SupplyCnn"); } string str = "select ApprovalLevel,SUBSTRING(AppType,1,1) as Type,SUBSTRING(AppType,3,1) as num from [" + arr[0] + "].." + arr[1] + " where PID = '" + PID + "' and state = '0'"; DataTable dt = SQLBase.FillTable(str); string Type = ""; int num = 0; int bol = 0; int Hcount = 0; for (int i = 0; i < dt.Rows.Count; i++) { Type = dt.Rows[i]["Type"].ToString(); if (Type == "1") { bol = 1; break; } if (Type == "2") { bol = 1; break; } if (Type == "3") { num = Convert.ToInt16(dt.Rows[i]["num"]); string level = dt.Rows[i]["ApprovalLevel"].ToString(); string str1 = "select count(*) from [" + arr[0] + "].." + arr[1] + " where PID = '" + PID + "' and state = '1' and AppType = '3-" + num + "'"; DataTable dt2 = SQLBase.FillTable(str1); if (dt2.Rows.Count > 0) { Hcount = Convert.ToInt16(dt2.Rows[0][0]); } if (Hcount < num) { bol = 1; break; } } } //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/23/22/tk_PID/10/tk_UserLog 准出停止 //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/26/25/tk_PID/10/tk_UserLog 准出暂停 //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/29/28/tk_PID/10/tk_UserLog 准出淘汰 //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/62/61/tk_PID/29/tk_UserLog 年度 //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/10/73/tk_PID/75/tk_UserLog 恢复供货 string strAllBas = ""; if (bol == 0 && state != -1) { if (arr[2].IndexOf("..") > 0 && arr[4] == "23") { strAllBas = "update " + arr[2] + " set State = '" + arr[4] + "',wstate='3' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[4] == "26") { strAllBas = "update " + arr[2] + " set State = '" + arr[4] + "',wstate='2' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[4] == "29") { strAllBas = "update " + arr[2] + " set State = '" + arr[4] + "',wstate='4' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[4] == "10") { strAllBas = "update " + arr[2] + " set State = '" + arr[4] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[4] == "4") { strAllBas = "update " + arr[2] + " set State = '" + arr[4] + "',wstate='0' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[4] == "62") { strAllBas = "update " + arr[2] + " set nState = '" + arr[4] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[4] == "23") { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[4] + "',wstate='3' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[4] == "26") { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[4] + "',wstate='2' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[4] == "29") { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[4] + "',wstate='4' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[4] == "10") { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[4] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[4] == "4") { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[4] + "',wstate='0' where " + arr[3] + " = '" + RelevanceID + "'"; } else { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set nState = '" + arr[4] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } } else { strAllBas = ""; } if (strAllBas != "") { intAllBas = SQLBase.ExecuteNonQuery(strAllBas, "SupplyCnn"); } return(intInsertBas + intUpdateBas); }