Exemple #1
0
        /// <summary>
        /// 查询用户的窗体权限
        /// </summary>
        public bool QueryUserFormPower(string formNameStr)
        {
            if (SystemInfo.user.AutoId == 1)
            {
                return(true);
            }

            string sqlStr = string.Format("select Count(*) from BS_RoleMenu where RoleNo = '{0}' and MenuName in (select MenuName from BS_Menu where FormName = '{1}')", SystemInfo.user.RoleNo, formNameStr);
            int    count  = DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr));

            if (count > 0)
            {
                return(true);
            }
            else
            {
                sqlStr = string.Format("select MenuText from BS_Menu where FormName = '{0}'", formNameStr);
                string menuText = DataTypeConvert.GetString(BaseSQL.GetSingle(sqlStr));
                if (menuText != "")
                {
                    MessageHandler.ShowMessageBox(string.Format("您没有查看[{0}]的权限,如果需要查看请联系系统管理员。", menuText));
                }
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// 判断站号是否包含在项目号中
        /// </summary>
        /// <param name="projectNoStr">项目号</param>
        /// <param name="stnNoStr">站号</param>
        public bool StnNoIsContainProjectNo(string projectNoStr, string stnNoStr)
        {
            string sqlStr = string.Format("select Count(*) from BS_StnList where ProjectNo='{0}' and StnNo='{1}'", projectNoStr, stnNoStr);
            int    count  = DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr));

            return(count == 0 ? false : true);
        }
Exemple #3
0
        /// <summary>
        /// 查询该登陆ID的用户数量
        /// </summary>
        public int QueryUserInfoCount(string loginIdStr)
        {
            string sqlStr = string.Format("select Count(*) from BS_UserInfo where LoginId = '{0}'", loginIdStr);
            int    count  = DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr));

            return(count);
        }
Exemple #4
0
        /// <summary>
        /// 查询用户按钮的权限
        /// </summary>
        public static bool QueryUserButtonPower(string formNameStr, string formTextStr, object sender, bool isMessage)
        {
            if (sender == null || !SystemInfo.IsCheckUserButtonPower)
            {
                return(true);
            }

            string buttonNameStr = "";
            string buttonTextStr = "";

            switch (sender.GetType().ToString())
            {
            case "DevExpress.XtraEditors.SimpleButton":
                SimpleButton sbtn = (SimpleButton)sender;
                buttonNameStr = sbtn.Name;
                buttonTextStr = sbtn.Text;
                break;

            case "System.Windows.Forms.Button":
                Button btn = (Button)sender;
                buttonNameStr = btn.Name;
                buttonTextStr = btn.Text;
                break;

            default:
                return(true);
            }

            string sqlStr = string.Format("select Count(*) from BS_MenuButton where MenuName in (select MenuName from BS_Menu where FormName = '{0}') and ButtonName = '{1}' and AutoId in (select MenuButtonId from BS_UserMenuButton where UserNo = {2})", formNameStr, buttonNameStr, SystemInfo.user.AutoId);
            int    count  = DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr));

            if (count > 0)
            {
                return(true);
            }
            else
            {
                sqlStr = string.Format("select Count(*) from BS_Menu where FormName = '{0}'", formNameStr);
                if (DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)) == 0)
                {
                    return(true);
                }
                else
                {
                    if (isMessage)
                    {
                        MessageHandler.ShowMessageBox(string.Format("您没有操作模块【{0}】中按钮【{1}】的操作权限,请联系相关的负责管理员。", formTextStr, buttonTextStr));
                    }
                    return(false);
                }
            }
        }
Exemple #5
0
        //判断用Sql查询的数据是否存在,true表示存在,False表示不存在
        public static bool Exists(string strSql)
        {
            object obj = BaseSQL.GetSingle(strSql);
            int    cmdresult;

            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #6
0
        /// <summary>
        /// 获得MenuButtonId
        /// </summary>
        /// <param name="strMenuName"></param>
        /// <param name="strButtonName"></param>
        /// <returns></returns>
        public static int GetMenuButtonId(string strMenuName, string strButtonName)
        {
            string strSql = @"select autoId from BS_MenuButton " +
                            "where menuName like '" + strMenuName + "' and buttonName like '" + strButtonName + "'";
            DataTable dt = new DataTable();

            dt = BaseSQL.GetTableBySql(strSql);
            if (dt.Rows.Count == 0)
            {
                string sql       = string.Format("select Count(*) from BS_Button where ButtonName = '{0}'", strButtonName);
                string insertSql = "";
                if (DataTypeConvert.GetInt(BaseSQL.GetSingle(sql)) == 0)
                {
                    insertSql = string.Format("Insert into BS_Button (ButtonName, ButtonText) values ('{0}', '{1}')", strButtonName, "");
                    BaseSQL.ExecuteSql(insertSql);
                }

                insertSql = string.Format("Insert Into BS_MenuButton (MenuName, ButtonName) values ('{0}', '{1}')", strMenuName, strButtonName);
                BaseSQL.ExecuteSql(insertSql);
                dt = BaseSQL.GetTableBySql(strSql);
            }

            return((int)dt.Rows[0]["AutoId"]);
        }
Exemple #7
0
        /// <summary>
        /// 查询和当前零件编号相同的零件个数
        /// </summary>
        public int QueryPartsCode_CodeFileNameCount(string codeFileNameStr)
        {
            string sqlStr = string.Format("select Count(*) from SW_PartsCode where CodeFileName = '{0}'", codeFileNameStr);

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #8
0
        /// <summary>
        /// 查询和当前零件编号相同的Bom信息数量
        /// </summary>
        public int QueryBom_CodeFileNameCount(string codeFileNameStr)
        {
            string sqlStr = string.Format("select Count(*) from BS_BomManagement where MaterielNo = '{0}'", codeFileNameStr);

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #9
0
        /// <summary>
        /// 查询项目状态信息的默认编号
        /// </summary>
        public int GetProjectStatus_DefaultAutoId()
        {
            string sqlStr = "select AutoId from BS_ProjectStatus where IsDefault = 1";

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #10
0
        /// <summary>
        /// 查询项目状态信息的默认数量
        /// </summary>
        public int GetProjectStatus_DefaultCount(int autoIdInt)
        {
            string sqlStr = string.Format("select Count(*) from BS_ProjectStatus where IsDefault = 1 and AutoId != {0}", autoIdInt);

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #11
0
        /// <summary>
        /// 查询单个系统参数值
        /// </summary>
        public static object QuerySystemParameter_Single(string moduleCateStr, string keyStr)
        {
            string sqlStr = string.Format("select ParameterValue from BS_SysParameter where ModuleCate = '{0}' and ParameterKey = '{1}'", moduleCateStr, keyStr);

            return(BaseSQL.GetSingle(sqlStr));
        }
Exemple #12
0
        /// <summary>
        /// 刷新所有的系统参数
        /// </summary>
        public void RefreshAllSystemParameter()
        {
            DataTable sysParameterTable = new DataTable();

            QuerySystemParameter(sysParameterTable);

            #region 常规

            string tmpStr = GetValue(sysParameterTable, "Common", "PageRowCount");
            if (tmpStr != "")
            {
                SystemInfo.OrderQueryGrid_PageRowCount = DataTypeConvert.GetInt(tmpStr);
            }

            tmpStr = GetValue(sysParameterTable, "Common", "DateIntervalDays");
            if (tmpStr != "")
            {
                SystemInfo.OrderQueryDate_DateIntervalDays = DataTypeConvert.GetInt(tmpStr);
            }

            tmpStr = GetValue(sysParameterTable, "Common", "FormDragDropMaxRecordCount");
            if (tmpStr != "")
            {
                SystemInfo.FormDragDropMaxRecordCount = DataTypeConvert.GetInt(tmpStr);
            }

            tmpStr = GetValue(sysParameterTable, "Common", "LeftDockWidth");
            if (tmpStr != "")
            {
                SystemInfo.DragForm_LeftDock_Width = DataTypeConvert.GetInt(tmpStr);
            }

            tmpStr = GetValue(sysParameterTable, "Common", "EnableWorkFlowMessage");
            if (tmpStr != "")
            {
                SystemInfo.EnableWorkFlowMessage = tmpStr == "1";
            }

            tmpStr = GetValue(sysParameterTable, "Common", "ApproveAfterPrint");
            if (tmpStr != "")
            {
                SystemInfo.ApproveAfterPrint = tmpStr == "1";
            }

            #endregion

            #region 销售

            tmpStr = GetValue(sysParameterTable, "Sale", "QuotationDefaultTax");
            if (tmpStr != "")
            {
                SystemInfo.Quotation_DefaultTax = DataTypeConvert.GetDouble(tmpStr);
            }

            tmpStr = GetValue(sysParameterTable, "Sale", "SalesOrderDefaultTax");
            if (tmpStr != "")
            {
                SystemInfo.SalesOrder_DefaultTax = DataTypeConvert.GetDouble(tmpStr);
            }

            #endregion

            #region 项目

            tmpStr = GetValue(sysParameterTable, "Project", "GanttResourcesPerPage");
            if (tmpStr != "")
            {
                SystemInfo.Gantt_ResourcesPerPage = DataTypeConvert.GetInt(tmpStr);
            }

            tmpStr = GetValue(sysParameterTable, "Project", "GanttSchedulerBarHeight");
            if (tmpStr != "")
            {
                SystemInfo.Gantt_SchedulerBarHeight = DataTypeConvert.GetInt(tmpStr);
            }

            tmpStr = GetValue(sysParameterTable, "Project", "GanttSchedulerBarColor");
            if (tmpStr != "")
            {
                SystemInfo.Gantt_SchedulerBarColor = System.Drawing.ColorTranslator.FromHtml(tmpStr);
            }

            #endregion

            #region 采购

            tmpStr = GetValue(sysParameterTable, "Purchase", "PrReqIsAlterPSBomAutoId");
            if (tmpStr != "")
            {
                SystemInfo.PrReqIsAlter_PSBomAutoId = tmpStr == "1";
            }

            tmpStr = GetValue(sysParameterTable, "Purchase", "OrderListDefaultTax");
            if (tmpStr != "")
            {
                SystemInfo.OrderList_DefaultTax = DataTypeConvert.GetDouble(tmpStr);
            }

            tmpStr = GetValue(sysParameterTable, "Purchase", "SettlementDefaultTax");
            if (tmpStr != "")
            {
                SystemInfo.Settlement_DefaultTax = DataTypeConvert.GetDouble(tmpStr);
            }

            tmpStr = GetValue(sysParameterTable, "Purchase", "OrderNoWarehousingDays");
            if (tmpStr != "")
            {
                SystemInfo.OrderNoWarehousing_Days = DataTypeConvert.GetInt(tmpStr);
            }

            tmpStr = GetValue(sysParameterTable, "Purchase", "PrReqApplyBeyondCountIsSave");
            if (tmpStr != "")
            {
                SystemInfo.PrReqApplyBeyondCountIsSave = tmpStr == "1";
            }

            tmpStr = GetValue(sysParameterTable, "Purchase", "WWApplyBeyondCountIsSave");
            if (tmpStr != "")
            {
                SystemInfo.WarehouseWarrantApplyBeyondCountIsSave = tmpStr == "1";
            }

            tmpStr = GetValue(sysParameterTable, "Purchase", "PrListDistributionMessage");
            if (tmpStr != "")
            {
                SystemInfo.PrListDistributionMessage = tmpStr == "1";
            }

            tmpStr = GetValue(sysParameterTable, "Purchase", "PrListDistributionAllHandle");
            if (tmpStr != "")
            {
                SystemInfo.PrListDistributionAllHandle = tmpStr == "1";
            }

            #endregion

            #region 库存

            tmpStr = GetValue(sysParameterTable, "Warehouse", "OrderApplyBeyondCountIsSave");
            if (tmpStr != "")
            {
                SystemInfo.OrderApplyBeyondCountIsSave = tmpStr == "1";
            }

            tmpStr = GetValue(sysParameterTable, "Warehouse", "WWIsAlterDate");
            if (tmpStr != "")
            {
                SystemInfo.WarehouseWarrantIsAlterDate = tmpStr == "1";
            }

            tmpStr = GetValue(sysParameterTable, "Warehouse", "PPApplyBeyondCountIsSave");
            if (tmpStr != "")
            {
                SystemInfo.PPApplyBeyondCountIsSave = tmpStr == "1";
            }

            tmpStr = GetValue(sysParameterTable, "Warehouse", "WRIsAlterDate");
            if (tmpStr != "")
            {
                SystemInfo.WarehouseReceiptIsAlterDate = tmpStr == "1";
            }

            tmpStr = GetValue(sysParameterTable, "Warehouse", "DisableProjectNo");
            if (tmpStr != "")
            {
                SystemInfo.DisableProjectNo = tmpStr == "1";
            }

            tmpStr = GetValue(sysParameterTable, "Warehouse", "DisableShelfInfo");
            if (tmpStr != "")
            {
                SystemInfo.DisableShelfInfo = tmpStr == "1";
            }

            SystemInfo.DisableShelfInfo_Default_ShelfId = DataTypeConvert.GetInt(BaseSQL.GetSingle(string.Format("select AutoId from BS_ShelfInfo where ShelfNo = '{0}' and RepertoryInfoId is null and RepertoryLocationId is null", defaultShelfNo)));

            tmpStr = GetValue(sysParameterTable, "Warehouse", "EnableNegativeInventory");
            if (tmpStr != "")
            {
                SystemInfo.EnableNegativeInventory = tmpStr == "1";
            }

            tmpStr = GetValue(sysParameterTable, "Warehouse", "InventorySaveApproval");
            if (tmpStr != "")
            {
                SystemInfo.InventorySaveApproval = tmpStr == "1";
            }

            #endregion

            #region 生产



            #endregion

            #region 人事



            #endregion

            #region 会计



            #endregion
        }
Exemple #13
0
        public string QueryPartsCode_FilePath(string codeFileNameStr)
        {
            string sqlStr = string.Format("select FilePath from SW_PartsCode where CodeFileName = '{0}'", codeFileNameStr);

            return(DataTypeConvert.GetString(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #14
0
        /// <summary>
        /// 批量更新零件信息
        /// </summary>
        public int QueryPartsCode(string queryWhereSqlStr)
        {
            string sqlStr = string.Format("select Count(*) from SW_PartsCode where {0}", queryWhereSqlStr);

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }