public static decimal PriceAdjust(string cInvCode, string cCusCode) { string sSQL = ""; 系统服务.ClsDataBase clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); sSQL = @"select b.D1 from PriceAdjust_Details b left join PriceAdjust_Main a on a.ID=b.ID left join Customer c on b.S2=c.S4 where b.B1=1 and b.S1='" + cInvCode + "' and c.cCusCode='" + cCusCode + "' and a.dVerifysysTime is not null order by a.dDate desc"; DataTable dt = clsSQLCommond.ExecQuery(sSQL); if (dt.Rows.Count > 0) { return(规格化.ReturnDecimal(dt.Rows[0]["D1"])); } else { sSQL = @"select b.D1 from PriceAdjust_Details b left join PriceAdjust_Main a on a.ID=b.ID left join Customer c on b.S2=c.S4 where (b.B1<>1 or b.B1 is null ) and b.S1='" + cInvCode + "' and c.cCusCode='" + cCusCode + "' and a.dVerifysysTime is not null order by a.dDate desc"; DataTable dts = clsSQLCommond.ExecQuery(sSQL); if (dts.Rows.Count > 0) { return(规格化.ReturnDecimal(dts.Rows[0]["D1"])); } } return(0); }
/// <summary> /// 得到连续的序列号 /// </summary> /// <param name="TableName"></param> /// <param name="FieldName"></param> /// <param name="sID"></param> /// <returns></returns> public static string GetNewSerialNumberContinuous(string TableName, string FieldName) { 系统服务.ClsDataBase clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); string sSQL = "select * from _SerialNumberContinuous where TableID='" + TableName + "' and Code='" + FieldName + "'"; DataTable dts = clsSQLCommond.ExecQuery(sSQL); string left = ""; string middle = ""; string right = ""; if (dts.Rows[0]["LeftType"].ToString() != "") { left = dts.Rows[0]["LeftType"].ToString(); } if (dts.Rows[0]["MiddleType"].ToString() == "DateTime") { middle = DateTime.Now.ToString("yyMM"); } sSQL = "select isnull(max(" + FieldName + "),0) from " + TableName; DataTable dt = clsSQLCommond.ExecQuery(sSQL); if (dt.Rows[0][0].ToString() != "0") { right = dt.Rows[0][0].ToString(); right = right.Substring(left.Length + middle.Length, dts.Rows[0]["RightType"].ToString().Length); int iright = int.Parse(right) + 1; right = GetIsEnoughNumber(iright, dts.Rows[0]["RightType"].ToString().Length); } else { right = GetIsEnoughNumber(1, dts.Rows[0]["RightType"].ToString().Length); } return(left + middle + right); }
/// <summary> /// 权限判断 /// </summary> /// <returns></returns> private bool hasRight(string sInfo, string sUid) { bool b = false; try { clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); string sSQL = "SELECT COUNT(*) AS iCount " + "FROM dbo._RoleRight INNER JOIN dbo._UserRoleInfo ON _RoleRight.vchrRoleID = dbo._UserRoleInfo.vchrRoleID " + "WHERE dbo._UserRoleInfo.vchrUserID = '" + sUid + "' and dbo._RoleRight.vchrRoleRight = '" + sInfo + "' "; int iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL)); if (iCou > 0) { b = true; } else { b = false; } } catch { throw new Exception("判断权限失败!"); } return(b); }
/// <summary> /// 判断编码原则 /// </summary> /// <param name="TableID"></param> /// <param name="Code"></param> /// <param name="oldID"></param> /// <param name="thisID"></param> /// <returns></returns> public static string CheckSerialNumber(string TableID, string oldID, string thisID) { if (oldID == thisID.Substring(0, oldID.Length)) { 系统服务.ClsDataBase clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); string sSQL = "select * from SerialNumber where TableID='" + TableID + "'"; DataTable dt = clsSQLCommond.ExecQuery(sSQL); int t = 0; string[] type = dt.Rows[0]["Type"].ToString().Split('-'); for (int i = 0; i < type.Length; i++) { if (t < oldID.Length) { t = t + type[i].Length; } else { if (t + type[i].Length != thisID.Length) { return("不符合编码原则,编码原则" + dt.Rows[0]["Type"].ToString()); } else { return(""); } } } } else { return("不符合编码原则,子类别编码左侧必须等于类别编码"); } return(""); }
public MdiMain() { InitInfo(); InitializeComponent(); m_FormList = new Dictionary <string, Form>(); BarLocalizer.Active = new ChineseLocalizer(); GridLocalizer.Active = new ChineseGridLocalizer(); Localizer.Active = new ChineseEditorsLocalizer(); if (Login()) { bIsLogined = true; } else { bIsLogined = false; } clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); xtraTabbedMdiManager.SelectedPageChanged += new System.EventHandler(this.xtraTabbedMdiManager2_SelectedPageChanged); }
private void SetTree() { try { string sSQL2 = @"select count(*) from dbo._UserRoleInfo where vchrRoleID = 'administrator' and vchrUserID = '" + 系统服务.ClsBaseDataInfo.sUid + "'"; string sSQL; if (系统服务.ClsBaseDataInfo.sUid == "admin" || 系统服务.ClsBaseDataInfo.sUid == "system") { sSQL = "SELECT TOP 100 PERCENT * FROM dbo._Form WHERE (1 = 1) AND (fbitNoUse = 0) AND (fbitHide = 0) and (vchrFormBel='" + 系统服务.ClsBaseDataInfo.sProForm + "' or vchrFormBel is null) ORDER BY fIntOrderID"; } else if (Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL2)) != 0) { sSQL = "SELECT TOP 100 PERCENT * FROM dbo._Form WHERE (isnull(bUse,0) = 1) AND (fbitNoUse = 0) AND (fbitHide = 0) and (vchrFormBel='" + 系统服务.ClsBaseDataInfo.sProForm + "' or vchrFormBel is null) ORDER BY fIntOrderID"; } else { sSQL = "SELECT DISTINCT " + " dbo._Form.fchrFrmNameID, dbo._Form.fchrFrmText, dbo._Form.fchrNameSpace, " + " dbo._Form.fchrFrmUpName, "+ " dbo._Form.fbitHide, dbo._Form.fbitNoUse, dbo._Form.fIntOrderID " + "FROM dbo._RoleInfo INNER JOIN " + " dbo._RoleRight ON dbo._RoleInfo.vchrRoleID = dbo._RoleRight.vchrRoleID INNER JOIN " + " dbo._UserRoleInfo ON dbo._RoleInfo.vchrRoleID = dbo._UserRoleInfo.vchrRoleID and dbo._UserRoleInfo.vchrUserID='" + 系统服务.ClsBaseDataInfo.sUid + "' INNER JOIN " + " dbo._Form ON 1=1 " + " AND dbo._Form.fchrFrmNameID +'/'+dbo._Form.fchrFrmText= RTRIM(LTRIM(RIGHT(dbo._RoleRight.vchrRoleRight, LEN(dbo._RoleRight.vchrRoleRight) - CHARINDEX('|', dbo._RoleRight.vchrRoleRight)))) "+ "WHERE (isnull(bUse,0) = 1) AND (fbitNoUse = 0) AND (fbitHide = 0) and (vchrFormBel='" + 系统服务.ClsBaseDataInfo.sProForm + "' or vchrFormBel is null) " + "ORDER BY fIntOrderID "; } clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); dt = clsSQLCommond.ExecQuery(sSQL); //ClsUseWebService clsWeb = new ClsUseWebService(); //dt = clsWeb.dtMainSetTree(系统服务.ClsBaseDataInfo.sUid, 系统服务.ClsBaseDataInfo.sProForm); if (iBtnType == 0) { InitTree(treView.Nodes, "业务工作"); } if (iBtnType == 1) { InitTree(treView.Nodes, "基础设置"); } if (iBtnType == 2) { InitTree(treView.Nodes, "系统服务"); } } catch (Exception ee) { throw new Exception(ee.Message); } }
public bool bchk时间锁() { 系统服务.ClsDataBase clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); DateTime d时间锁 = Convert.ToDateTime("2016-1-1"); string sSQL = "select getdate()"; DateTime d当前日期 = Convert.ToDateTime(clsSQLCommond.ExecQuery(sSQL).Rows[0][0]); if (d当前日期 > d时间锁) { return(false); } else { return(true); } }
/// <summary> /// 存货档案 /// </summary> /// <param name="par">存货档案编码</param> /// <returns></returns> public static DataTable Inventory(string par) { 系统服务.ClsDataBase clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); string sSQL = @"select cInvCode,cInvName,cInvAddCode,cInvStd from @u8.Inventory where 1=1 "; if (par != "") { sSQL = sSQL + " and cInvCode='" + par + "'"; } sSQL = sSQL + " order by cInvCode "; DataTable dt = clsSQLCommond.ExecQuery(sSQL); DataRow dr = dt.NewRow(); dt.Rows.InsertAt(dr, 0); return(dt); }
/// <summary> /// 供应商 /// </summary> /// <param name="par">供应商</param> /// <returns></returns> public static DataTable Vendor(string par) { 系统服务.ClsDataBase clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); string sSQL = @"select DISTINCT VenCode from Registers where 1=1 "; if (par != "") { sSQL = sSQL + " and VenCode='" + par + "'"; } sSQL = sSQL + " order by VenCode "; DataTable dt = clsSQLCommond.ExecQuery(sSQL); DataRow dr = dt.NewRow(); dt.Rows.InsertAt(dr, 0); return(dt); }
/// <summary> /// 门号 /// </summary> /// <param name="par">门号</param> /// <returns></returns> public static DataTable Door(string par) { 系统服务.ClsDataBase clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); string sSQL = @"select DISTINCT iDoor from Gate where 1=1 and isnull(iDoor,'') <> '' "; if (par != "") { sSQL = sSQL + " and iDoor='" + par + "'"; } sSQL = sSQL + " order by iDoor "; DataTable dt = clsSQLCommond.ExecQuery(sSQL); DataRow dr = dt.NewRow(); dt.Rows.InsertAt(dr, 0); return(dt); }
public static void Get(string SoAutoID, System.Collections.ArrayList aList) { string sSQL = ""; 系统服务.ClsDataBase clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); sSQL = @"select 2 as iType,a.cSOCode as cTypeCode,a.dDate,a.cCusCode,a.cPersonCode,a.cDepCode,a.ECode,a.cPayCode,a.iMoney,sum(c.iReMoney) as iReMoney,AutoID ,订单利润,订单金额 ,最后收款时间,利润分成,a.ID from (select a.ID,a.cSOCode,a.dDate,a.cCusCode,a.cPersonCode,a.cDepCode,a.ECode,a.cPayCode,sum(b.iMoney+isnull(r.iMoney,0)-isnull(h.iMoney,0)) as iMoney,a.cSTCode,b.AutoID,a.D3 订单利润,b.iMoney as 订单金额,a.D2 as 利润分成 from dbo.SO_SOMain a inner join dbo.SO_SODetails b on a.id = b.id left join (select SoAutoID,sum(isnull(iQuantity,0)) as iQuantity,sum(isnull(iNum,0)) as iNum ,sum(isnull(iNatMoney,0)) as iNatMoney ,sum(isnull(iMoney,0)) as iMoney from SO_SOReturns group by SoAutoID) r on b.AutoID=r.SoAutoID left join (select SoAutoID,sum(isnull(iMoney,0)) as iMoney from SaleVerifications group by SoAutoID) h on b.AutoID=h.SoAutoID where isnull(a.dVerifysysPerson,'') <> '' and isnull(a.dClosesysPerson,'') = '' group by a.ID,b.AutoID,a.cSOCode,a.dDate,a.cCusCode,a.cPersonCode,a.cDepCode,a.ECode,a.cPayCode,a.cSTCode,a.D3,b.iMoney,a.D2) a left join (select sum(isnull(iMoneyNow,0)) as iReMoney,max(dDate) as 最后收款时间,cCusCode,cTypeCode from SO_CloseBill a inner join SO_CloseBillDetails b on a.id = b.id group by cCusCode,cTypeCode) c on c.cCusCode = a.cCusCode and c.cTypeCode = a.cSOCode where 1=1 and a.AutoID=" + SoAutoID + " group by a.cSOCode,a.dDate,a.cCusCode,a.cPersonCode,a.cDepCode,a.ECode,a.cPayCode,a.iMoney ,a.AutoID,订单利润,订单金额,最后收款时间,利润分成,a.ID having sum(isnull(a.iMoney,0)) <= sum(isnull(c.iReMoney,0))"; DataTable dtqty = clsSQLCommond.ExecQuery(sSQL); if (dtqty.Rows.Count > 0) { sSQL = @"select a.cSOCode,a.cDepCode,cPersonCode,a.cSTCode, (case when a.cSTCode='01' then 0.7 else 1 end)* ( b.iMoney-isnull(b.iQuantity*Cost,0)- (case when a.cSTCode='02' then 0.9 else 1 end)*ISNULL(e.iMoney,0)--子件金额 -isnull(f.iMoney*a.D5,0)--业务费用 )-isnull(r.F5,0) as iMoney from SO_SOMain a left join SO_SODetails b on a.ID=b.ID --left join (select SoAutoID,sum(-b.iQuantity) as iQuantity from SO_SOReturn a left join SO_SOReturns b on a.ID=b.ID where a.dVerifysysTime is not null group by SoAutoID) c on b.AutoID=c.SoAutoID left join (select sum(iQuantity) as iQuantity,sum(isnull(iMoney,0)) as iMoney,sum(case when B3=1 then -F5 when B3=1 then F5 end) as F5,SoAutoID from RdRecord a inner join RdRecords b on a.id = b.id left join RdStyle r on a.cRSCode=r.cRSCode where 收发标志=0 group by SoAutoID) r on r.SoAutoID = b.AutoID left join (select a.AutoID,sum(a.D1*a.iQuantity) as iMoney from SO_SOSublist a left join Inventory b on a.cInvCode=b.cInvCode where b.cInvClassCode<>'03' group by a.AutoID) e on b.AutoID=e.AutoID left join (select ID,sum((DD1*DD2)) as iMoney from SO_SOMainCommissiion group by ID) f on f.ID=a.ID left join Inventory i on b.cInvCode=i.cInvCode WHERE b.AutoID='" + SoAutoID + "'"; DataTable dt2 = clsSQLCommond.ExecQuery(sSQL); decimal 订单利润 = 系统服务.规格化.ReturnDecimal(dt2.Rows[0]["iMoney"]); decimal 订单金额 = 系统服务.规格化.ReturnDecimal(dtqty.Rows[0]["订单金额"]); decimal 收款金额 = 系统服务.规格化.ReturnDecimal(dtqty.Rows[0]["iMoney"]); decimal 利润分成 = 系统服务.规格化.ReturnDecimal(dtqty.Rows[0]["利润分成"]); string 最后收款时间 = dtqty.Rows[0]["最后收款时间"].ToString().Trim(); decimal 个人利润 = 系统服务.规格化.ReturnDecimal(订单利润 * 利润分成); string id = dtqty.Rows[0]["ID"].ToString().Trim(); sSQL = "update SO_SOMain set D4='" + 订单利润 + "',Date1='" + 最后收款时间 + "',D6='" + 个人利润 + "' where ID='" + id + "'"; aList.Add(sSQL); } }
public void GetPeriod(string p, out string sdate, out string edate) { string sSQL = ""; 系统服务.ClsDataBase clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); sSQL = @"select * from UfSystem.dbo.UA_Period where iYear='" + 系统服务.ClsBaseDataInfo.sUFDataBaseYear + "' and iId='" + p + "' "; DataTable dt = clsSQLCommond.ExecQuery(sSQL); if (dt.Rows.Count > 0) { sdate = DateTime.Parse(dt.Rows[0]["dBegin"].ToString()).ToString("yyyy-MM-dd"); edate = DateTime.Parse(dt.Rows[0]["dEnd"].ToString()).ToString("yyyy-MM-dd"); } else { sdate = ""; edate = ""; } }
public FrmLogin() { 系统服务.ClsBaseDataInfo.sDataBaseType = GetConfigValue(sPathConfig, "DataBaseType"); InitializeComponent(); try { clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); clsDES = 系统服务.ClsDES.Instance(); InitInfo(); label1.Visible = bU8Improt; lookUpAcc.Visible = bU8Improt; tabControl1.Visible = false; } catch { } }
/// <summary> /// 获得帐套数据, /// </summary> /// <param name="sSQL"></param> private void GetAccInfo() { try { clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); string sSQL = "SELECT DISTINCT A.cAcc_Id,'[' + A.cAcc_Id + ']' + A.cAcc_Name as vchrText " + "FROM UFSystem.dbo.UA_Account A,UFSystem.dbo.UA_period P " + "WHERE A.cAcc_Id=P.cAcc_Id AND (P.bIsDelete=0 OR P.bIsDelete IS NULL) " + "ORDER BY A.cAcc_Id,vchrText"; DataTable dt = clsSQLCommond.ExecQuery(sSQL); lookUpAcc.Properties.DataSource = dt; lookUpAcc.EditValue = GetConfigValue(sPathConfig, "AccountInfo"); } catch { throw new Exception("获得帐套信息失败!"); } }
/// <summary> /// 获得帐套数据, /// </summary> /// <param name="sSQL"></param> private void GetAccInfo() { try { string sSQL = @" SELECT TOP (200) iID, Year, DataBasename FROM _Year order by iID "; clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); DataTable dt = clsSQLCommond.ExecQuery(sSQL); lookUpAcc.Properties.DataSource = dt; lookUpAcc.EditValue = dt.Rows[0]["DataBasename"].ToString().Trim(); } catch (Exception ee) { throw new Exception("获得帐套信息失败!"); } }
public ClsRoleEditQuery() { clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); }
private void btnLogin_Click(object sender, EventArgs e) { try { clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); if (bU8Improt && lookUpAcc.Text.Trim() == string.Empty) { MessageBox.Show("请选择帐套", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); lookUpAcc.Focus(); return; } if (!chkBaseInfo()) { MessageBox.Show("请检查信息是否完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string sErrInfo; if (!Login(out sErrInfo)) { MessageBox.Show("登陆失败!\n\n原因:\n " + sErrInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtUID.Focus(); return; } if (chkPWD.Checked) { string sPWD = ""; FrmChangePWD frmChgPWD = new FrmChangePWD(); frmChgPWD.ShowDialog(); if (frmChgPWD.DialogResult == DialogResult.OK) { sPWD = frmChgPWD.sNewPWD; string sSQL = "update _UserInfo set vchrPwd = '" + clsDES.Encrypt(sPWD) + "' where vchrUid = '" + txtUID.Text.Trim() + "'"; clsSQLCommond.ExecSql(sSQL); MessageBox.Show("修改密码成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } WriteConfig(); try { 系统服务.ClsBaseDataInfo.sUid = txtUID.Text.Trim(); 系统服务.ClsBaseDataInfo.sLogDate = dtmLogin.Text.Trim(); 系统服务.ClsBaseDataInfo.sDataBaseName = txtDataBase.Text; if (bU8Improt) { 系统服务.ClsBaseDataInfo.sUFDataBaseName = "UFDATA_" + lookUpAcc.EditValue.ToString().Trim() + "_" + dtmLogin.DateTime.ToString("yyyy").Trim(); 系统服务.ClsBaseDataInfo.sUFDataBaseYear = dtmLogin.DateTime.ToString("yyyy").Trim(); 系统服务.ClsBaseDataInfo.sUFDataBaseText = lookUpAcc.Text.Trim(); 系统服务.ClsBaseDataInfo.sConnString2 = 系统服务.ClsBaseDataInfo.sConnString.Replace(系统服务.ClsBaseDataInfo.sDataBaseName, 系统服务.ClsBaseDataInfo.sUFDataBaseName); } string sSQL = "select vchrName from dbo._UserInfo where vchrUid = '" + txtUID.Text.Trim() + "' "; 系统服务.ClsBaseDataInfo.sUserName = clsSQLCommond.ExecGetScalar(sSQL).ToString().Trim(); if (bU8Improt) { sSQL = "select count(*) from Master.dbo.sysdatabases where name='" + 系统服务.ClsBaseDataInfo.sUFDataBaseName + "'"; int iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL)); if (iCou == 0) { MessageBox.Show("年度帐不存在,日期请选择" + dtmLogin.DateTime.AddYears(-1).ToString("yyyy").Trim() + "-12-31"); return; } } } catch { } DbHelperSQL.connectionString = 系统服务.ClsBaseDataInfo.sConnString; DialogResult = DialogResult.OK; } catch (Exception ee) { MessageBox.Show("登陆失败! " + ee.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { try { Cursor.Current = Cursors.WaitCursor; string sInfo = this.Name + "|" + e.ClickedItem.Name; if (e.ClickedItem.Name.ToLower().Trim() == "exit") { //if (MessageBox.Show("是否关闭当前窗体?\n是:关闭\n否:取消", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes) //{ // sSQL = "insert into Define1(S1,s2,S3,S4,S5,S6,SysCreateDate)values('" + 系统服务.ClsBaseDataInfo.sUid + "','" + 系统服务.ClsBaseDataInfo.sUserName + "','" + this.Name + "','" + this.Text + "','" + e.ClickedItem.Name.Trim() + "','" + e.ClickedItem.Text.Trim() + "',getdate())"; // clsSQLCommond.ExecSql(sSQL); this.Close(); return; //} } clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); string sSQL2 = @"select count(*) from dbo._UserRoleInfo where vchrRoleID = 'administrator' and vchrUserID = '" + sUid + "'"; bool b = false; if (sUid == "admin" || sUid == "system") { b = true; } if (Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL2)) != 0) { b = true; } if (!b) { if (!hasRight(sInfo, sUid)) { e.ClickedItem.Enabled = false; MessageBox.Show("权限不足!"); return; } } //sSQL = "insert into Define1(S1,s2,S3,S4,S5,S6,SysCreateDate)values('" + 系统服务.ClsBaseDataInfo.sUid + "','" + 系统服务.ClsBaseDataInfo.sUserName + "','" + this.Name + "','" + this.Text + "','" + e.ClickedItem.Name.Trim() + "','" + e.ClickedItem.Text.Trim() + "',getdate())"; //clsSQLCommond.ExecSql(sSQL); BtnClick(e.ClickedItem.Name, e.ClickedItem.Text); if (dtBtnInfo != null && dtBtnInfo.Rows.Count > 0) { for (int i = 0; i < dtBtnInfo.Rows.Count; i++) { if (dtBtnInfo.Rows[i]["vchrBtnID"].ToString().Trim().ToLower() == e.ClickedItem.Name.ToLower().Trim()) { if (Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 0) { btnEnable = true; SetBtnEnable(btnEnable); } else if (Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 1 || Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 2) { SetBtnEnable(btnEnable); } else if (Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 3) { SetBtnEnable(true); } else if (Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 4) { SetBtnEnable(false); } else if (Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 5) { //SetBtnEnable(false); } } } } Cursor.Current = Cursors.Default; } catch (Exception ee) { MsgBox("操作失败", ee.Message); } }
/// <summary> /// 创建窗体按钮 /// </summary> private void CreateBtn(string sFormInfo) { clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); string sSQL2 = @"select count(*) from dbo._UserRoleInfo where vchrRoleID = 'administrator' and vchrUserID = '" + sUid + "'"; string sSQL = ""; if (sUid == "admin" || sUid == "system" || Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL2)) != 0) { sSQL = "SELECT TOP 100 PERCENT fchrFrmNameID, vchrBtnID, vchrBtnText, iIcon, vchrRemark, intOrder,isnull(bEnable,0) as bEnable " + "FROM dbo._FormBtnInfo " + "WHERE (fchrFrmNameID = '" + sFormInfo + "') " + "ORDER BY intOrder DESC"; } else { sSQL = "SELECT distinct _FormBtnInfo.fchrFrmNameID, vchrBtnID, vchrBtnText, _FormBtnInfo.vchrRemark, intOrder,isnull(bEnable,0) as bEnable , " + " RTRIM(LTRIM(LEFT(dbo._RoleRight.vchrRoleRight, CHARINDEX('|', dbo._RoleRight.vchrRoleRight) - 1))) AS vchrL, " + " RTRIM(LTRIM(RIGHT(dbo._RoleRight.vchrRoleRight, LEN(dbo._RoleRight.vchrRoleRight) - CHARINDEX('|', dbo._RoleRight.vchrRoleRight)))) " + " AS vchrR " + "FROM dbo._RoleInfo INNER JOIN " + " dbo._RoleRight ON dbo._RoleInfo.vchrRoleID = dbo._RoleRight.vchrRoleID INNER JOIN "+ " dbo._UserRoleInfo ON dbo._RoleInfo.vchrRoleID = dbo._UserRoleInfo.vchrRoleID AND dbo._UserRoleInfo.vchrUserID = '"+ sUid + "' " + " INNER JOIN "+ " dbo._FormBtnInfo ON vchrBtnID = RTRIM(LTRIM(RIGHT(dbo._RoleRight.vchrRoleRight, LEN(dbo._RoleRight.vchrRoleRight) - CHARINDEX('|', dbo._RoleRight.vchrRoleRight)))) AND fchrFrmNameID = RTRIM(LTRIM(LEFT(dbo._RoleRight.vchrRoleRight, CHARINDEX('|', dbo._RoleRight.vchrRoleRight) - 1))) "+ "WHERE (fchrFrmNameID = '" + sFormInfo + "') " + "ORDER BY intOrder DESC"; } DataTable dt = clsSQLCommond.ExecQuery(sSQL); if (dt == null || dt.Rows.Count < 1) { return; } dtBtnInfo = dt.Copy(); for (int i = 0; i < dt.Rows.Count; i++) { switch (Convert.ToInt32(dt.Rows[i]["bEnable"])) { case 0: toolStripMenuBtn.Items[dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower()].Enabled = true; break; case 1: toolStripMenuBtn.Items[dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower()].Enabled = true; break; case 2: toolStripMenuBtn.Items[dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower()].Enabled = false; break; case 5: toolStripMenuBtn.Items[dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower()].Enabled = true; break; default: toolStripMenuBtn.Items[dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower()].Enabled = false; break; } switch (dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower()) { case "layout": toolStripMenuBtn.Items["layout"].Visible = true; toolStripMenuBtn.Items["layout"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tLayout.Visible = true; break; case "printset": toolStripMenuBtn.Items["printset"].Visible = true; toolStripMenuBtn.Items["printset"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tLayout.Visible = true; break; case "export": toolStripMenuBtn.Items["export"].Visible = true; toolStripMenuBtn.Items["export"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tExport.Visible = true; break; case "print": toolStripMenuBtn.Items["print"].Visible = true; toolStripMenuBtn.Items["print"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tExport.Visible = true; break; case "unaudit": toolStripMenuBtn.Items["unaudit"].Visible = true; toolStripMenuBtn.Items["unaudit"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tAudit.Visible = true; break; case "audit": toolStripMenuBtn.Items["audit"].Visible = true; toolStripMenuBtn.Items["audit"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tAudit.Visible = true; break; case "unlock": toolStripMenuBtn.Items["unlock"].Visible = true; toolStripMenuBtn.Items["unlock"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tLock.Visible = true; break; case "lock": toolStripMenuBtn.Items["lock"].Visible = true; toolStripMenuBtn.Items["lock"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tLock.Visible = true; break; case "alter": toolStripMenuBtn.Items["alter"].Visible = true; toolStripMenuBtn.Items["alter"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tSave.Visible = true; break; case "undo": toolStripMenuBtn.Items["undo"].Visible = true; toolStripMenuBtn.Items["undo"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tSave.Visible = true; break; case "save": toolStripMenuBtn.Items["save"].Visible = true; toolStripMenuBtn.Items["save"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tSave.Visible = true; break; case "del": toolStripMenuBtn.Items["del"].Visible = true; toolStripMenuBtn.Items["del"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tAdd.Visible = true; break; case "edit": toolStripMenuBtn.Items["edit"].Visible = true; toolStripMenuBtn.Items["edit"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tAdd.Visible = true; break; case "add": toolStripMenuBtn.Items["add"].Visible = true; toolStripMenuBtn.Items["add"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tAdd.Visible = true; break; case "import": toolStripMenuBtn.Items["import"].Visible = true; toolStripMenuBtn.Items["import"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tAdd.Visible = true; break; case "delrow": toolStripMenuBtn.Items["delrow"].Visible = true; toolStripMenuBtn.Items["delrow"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tAddRow.Visible = true; break; case "addrow": toolStripMenuBtn.Items["addrow"].Visible = true; toolStripMenuBtn.Items["addrow"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tAddRow.Visible = true; break; case "last": toolStripMenuBtn.Items["last"].Visible = true; toolStripMenuBtn.Items["last"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tSel.Visible = true; lPageInfo.Visible = true; break; case "next": toolStripMenuBtn.Items["next"].Visible = true; toolStripMenuBtn.Items["next"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tSel.Visible = true; lPageInfo.Visible = true; break; case "prev": toolStripMenuBtn.Items["prev"].Visible = true; toolStripMenuBtn.Items["prev"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tSel.Visible = true; lPageInfo.Visible = true; break; case "first": toolStripMenuBtn.Items["first"].Visible = true; toolStripMenuBtn.Items["first"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tSel.Visible = true; lPageInfo.Visible = true; break; case "sel": toolStripMenuBtn.Items["sel"].Visible = true; toolStripMenuBtn.Items["sel"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); lPageInfo.Visible = true; break; case "refresh": toolStripMenuBtn.Items["refresh"].Visible = true; toolStripMenuBtn.Items["refresh"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); lPageInfo.Visible = true; break; case "open": toolStripMenuBtn.Items["open"].Visible = true; toolStripMenuBtn.Items["open"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tOpen.Visible = true; break; case "close": toolStripMenuBtn.Items["close"].Visible = true; toolStripMenuBtn.Items["close"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tOpen.Visible = true; break; case "buckup": toolStripMenuBtn.Items["buckup"].Visible = true; toolStripMenuBtn.Items["buckup"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tBuckUp.Visible = true; break; case "autobuckup": toolStripMenuBtn.Items["autobuckup"].Visible = true; toolStripMenuBtn.Items["autobuckup"].Text = dt.Rows[i]["vchrBtnText"].ToString().Trim(); toolStripMenuBtn.Items["layout"].Tag = dt.Rows[i]["bEnable"].ToString().Trim(); tBuckUp.Visible = true; break; } } dtBtnInfo = dt.Copy(); }
public ClsBuckUpDataBase() { clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); }
public ClsRoleRight() { clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); }
private void btnLogin_Click(object sender, EventArgs e) { try { clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); //if (lookUpAcc.Text.Trim() == string.Empty) //{ // MessageBox.Show("请选择帐套", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); // lookUpAcc.Focus(); // return; //} if (!chkBaseInfo()) { MessageBox.Show("请检查信息是否完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string sErrInfo; if (!Login(out sErrInfo)) { MessageBox.Show("登陆失败!\n\n原因:\n " + sErrInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtUID.Focus(); return; } if (chkPWD.Checked) { string sPWD = ""; FrmChangePWD frmChgPWD = new FrmChangePWD(); frmChgPWD.ShowDialog(); if (frmChgPWD.DialogResult == DialogResult.OK) { sPWD = frmChgPWD.sNewPWD; string sSQL = "update _UserInfo set vchrPwd = '" + clsDES.Encrypt(sPWD) + "' where vchrUid = '" + txtUID.Text.Trim() + "'"; clsSQLCommond.ExecSql(sSQL); MessageBox.Show("修改密码成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } WriteConfig(); try { 系统服务.ClsBaseDataInfo.sUid = txtUID.Text.Trim(); 系统服务.ClsBaseDataInfo.sLogDate = dtmLogin.Text.Trim(); 系统服务.ClsBaseDataInfo.sDataBaseName = txtDataBase.Text; string sSQL = "select vchrName from dbo._UserInfo where vchrUid = '" + txtUID.Text.Trim() + "' "; 系统服务.ClsBaseDataInfo.sUserName = clsSQLCommond.ExecGetScalar(sSQL).ToString().Trim(); } catch { } DialogResult = DialogResult.OK; } catch (Exception ee) { MessageBox.Show("登陆失败! " + ee.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ClsUserInfoQuery() { clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance(); }