Ejemplo n.º 1
0
        //编号 名称 类型 产能
        protected override string GetFilterSql(UserModel user, T_Team customer)
        {
            string strSql = " where isnull(isDel,0) != 2  ";
            string strAnd = " AND ";

            if (!Common_Func.IsNullOrEmpty(customer.teamCode))
            {
                strSql += strAnd;
                strSql += " (teamCode like '%" + customer.teamCode + "%')  ";
            }


            if (!string.IsNullOrEmpty(customer.teamName))
            {
                strSql += strAnd;
                strSql += " teamName like '%" + customer.teamName + "%'";
            }

            if (!string.IsNullOrEmpty(customer.LeaderCode))
            {
                strSql += strAnd;
                strSql += " LeaderCode like '%" + customer.LeaderCode + "%'";
            }

            if (!string.IsNullOrEmpty(customer.Position))
            {
                strSql += strAnd;
                strSql += " Position like '%" + customer.Position + "%'";
            }

            return(strSql);
        }
Ejemplo n.º 2
0
        internal AppVersionInfo GetModelFromDataReader(IDataReader dr)
        {
            AppVersionInfo model = new AppVersionInfo();

            model.ID           = dr["ID"].ToInt32();
            model.AppName      = dr["AppName"].ToDBString();
            model.AppVersion   = dr["AppVersion"].ToDBString();
            model.VersionType  = dr["VersionType"].ToInt32();
            model.VersionLevel = dr["VersionLevel"].ToInt32();
            model.VersionTitle = dr["VersionTitle"].ToDBString();
            model.VersionDesc  = dr["VersionDesc"].ToDBString();
            model.Creater      = dr["Creater"].ToDBString();
            model.CreateTime   = dr["CreateTime"].ToDateTime();

            if (Common_Func.readerExists(dr, "StrVersionType"))
            {
                model.StrVersionType = dr["StrVersionType"].ToDBString();
            }
            if (Common_Func.readerExists(dr, "StrVersionLevel"))
            {
                model.StrVersionLevel = dr["StrVersionLevel"].ToDBString();
            }

            return(model);
        }
Ejemplo n.º 3
0
        protected override string GetFilterSql(UserModel user, T_UserGroupInfo model)
        {
            string strSql = base.GetFilterSql(user, model);
            string strAnd = " and ";


            if (!Common_Func.IsNullOrEmpty(model.UserGroupNo))
            {
                strSql += strAnd;
                strSql += " (USERGROUPNO like '%" + model.UserGroupNo + "%')  ";
            }

            if (!Common_Func.IsNullOrEmpty(model.UserGroupName))
            {
                strSql += strAnd;
                strSql += " (USERGROUPNAME like '%" + model.UserGroupName + "%')  ";
            }

            if (model.UserGroupType >= 1)
            {
                strSql += strAnd;
                strSql += " USERGROUPTYPE = " + model.UserGroupType + "";
            }

            return(strSql);
        }
Ejemplo n.º 4
0
        protected override bool CheckModelBeforeSave(T_MaterialInfo model, ref string strError)
        {
            T_Material_DB mdb = new T_Material_DB();

            if (model == null)
            {
                strError = "客户端传来的实体类不能为空!";
                return(false);
            }

            if (Common_Func.IsNullOrEmpty(model.MaterialNo))
            {
                strError = "物料编号不能为空!";
                return(false);
            }

            if (Common_Func.IsNullOrEmpty(model.MaterialDesc))
            {
                strError = "物料名称不能为空!";
                return(false);
            }

            //新增的情况需要验证物料编号是否存在
            if (model.ID <= 0)
            {
                if (mdb.CheckMaterialExist(model) > 0)
                {
                    strError = "物料编码已经存在!";
                    return(false);
                }
            }


            return(true);
        }
Ejemplo n.º 5
0
        private void BindKeeperList()
        {
            string strError = string.Empty;

            //lstKeeper = FastTask.FastTask_Func.GetTempKeeperList(ref strError);
            if (lstKeeper == null || lstKeeper.Count <= 0)
            {
                lstKeeper = new List <UserInfo>();

                if (string.IsNullOrEmpty(strError))
                {
                    Common_Func.ErrorMessage("获取保管员信息错误!", "保管员获取失败", 2);
                }
                else
                {
                    Common_Func.ErrorMessage(strError, "保管员获取失败", 2);
                }
            }

            string[] arrKeeper = new string[lstKeeper.Count];
            int      i         = 0;

            foreach (UserInfo keeper in lstKeeper)
            {
                arrKeeper[i++] = keeper.UserName;
            }

            cbbKKeeper.DataSource         = lstKeeper;
            cbbKKeeper.DisplayMember      = "UserName";
            cbbKKeeper.ValueMember        = "UserNo";
            cbbKKeeper.DropDownStyle      = ComboBoxStyle.DropDown;
            cbbKKeeper.AutoCompleteSource = AutoCompleteSource.ListItems;
            cbbKKeeper.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cbbKKeeper.AutoCompleteCustomSource.AddRange(arrKeeper);
        }
Ejemplo n.º 6
0
        protected override string GetFilterSql(UserModel user, T_CustomerInfo customer)
        {
            string strSql = " where isnull(isDel,0) != 2  ";
            string strAnd = " and ";

            if (!Common_Func.IsNullOrEmpty(customer.CustomerNo))
            {
                strSql += strAnd;
                strSql += " (CustomerNo like '%" + customer.CustomerNo + "%' or CustomerName like '%" + customer.CustomerNo + "%')  ";
            }


            if (!string.IsNullOrEmpty(customer.ContactPerson))
            {
                strSql += strAnd;
                strSql += " ContactPerson like '%" + customer.ContactPerson + "%'";
            }

            if (!string.IsNullOrEmpty(customer.ContactTel))
            {
                strSql += strAnd;
                strSql += " ContactTel like '%" + customer.ContactTel + "%'";
            }
            if (!string.IsNullOrEmpty(customer.CustomerName))
            {
                strSql += strAnd;
                strSql += " CustomerName like '%" + customer.CustomerName + "%'";
            }



            return(strSql);
        }
Ejemplo n.º 7
0
        private TempMaterialInfo GetModelFromDataReader(SqlDataReader dr)
        {
            TempMaterialInfo model = new TempMaterialInfo();

            model.ID                 = dr["ID"].ToInt32();
            model.TempMaterialNo     = dr["TempMaterialNo"].ToDBString();
            model.TempMaterialDesc   = dr["TempMaterialDesc"].ToDBString();
            model.MaterialNo         = dr["MaterialNo"].ToDBString();
            model.MaterialDesc       = dr["MaterialDesc"].ToDBString();
            model.SapMaterialDoc     = dr["SapMaterialDoc"].ToDBString();
            model.ReplaceUser        = dr["ReplaceUser"].ToDBString();
            model.ReplaceTime        = dr["ReplaceTime"].ToDateTimeNull();
            model.TempMaterialStatus = dr["TempMaterialStatus"].ToInt32();
            model.IsDel              = dr["ISDEL"].ToInt32();
            model.Creater            = dr["CREATER"].ToDBString();
            model.CreateTime         = dr["CREATETIME"].ToDateTime();
            model.Modifyer           = dr["MODIFYER"].ToDBString();
            model.ModifyTime         = dr["MODIFYTIME"].ToDateTimeNull();

            if (Common_Func.readerExists(dr, "StrTempMaterialStatus"))
            {
                model.StrTempMaterialStatus = dr["StrTempMaterialStatus"].ToDBString();
            }

            model.Unit   = string.Empty;
            model.IsRohs = 2;

            return(model);
        }
Ejemplo n.º 8
0
        //编号 名称 类型 产能
        protected override string GetFilterSql(UserModel user, T_ProductLine customer)
        {
            string strSql = " where nvl(isDel,0) != 2  ";
            string strAnd = " AND ";

            if (!Common_Func.IsNullOrEmpty(customer.Sn))
            {
                strSql += strAnd;
                strSql += " (SN like '%" + customer.Sn + "%')  ";
            }


            if (!string.IsNullOrEmpty(customer.MachineLineName))
            {
                strSql += strAnd;
                strSql += " MachineLineName like '%" + customer.MachineLineName + "%'";
            }

            if (!string.IsNullOrEmpty(customer.LineType))
            {
                strSql += strAnd;
                strSql += " LineType = '" + customer.LineType + "'";
            }

            return(strSql);
        }
Ejemplo n.º 9
0
        private CheckInfo GetModelFromDataReader(SqlDataReader dr)
        {
            CheckInfo model = new CheckInfo();

            model.ID          = dr["ID"].ToInt32();
            model.CheckNo     = dr["CheckNo"].ToDBString();
            model.CheckType   = dr["CheckType"].ToInt32();
            model.DutyUser    = dr["DutyUser"].ToDBString();
            model.CheckDesc   = dr["CheckDesc"].ToDBString();
            model.CheckStatus = dr["CheckStatus"].ToInt32();
            model.BeginTime   = dr["BeginTime"].ToDateTimeNull();
            model.DoneTime    = dr["DoneTime"].ToDateTimeNull();
            model.Remarks     = dr["Remarks"].ToDBString();
            model.IsDel       = dr["ISDEL"].ToInt32();
            model.Creater     = dr["CREATER"].ToDBString();
            model.CreateTime  = dr["CREATETIME"].ToDateTime();
            model.Modifyer    = dr["MODIFYER"].ToDBString();
            model.ModifyTime  = dr["MODIFYTIME"].ToDateTimeNull();

            if (Common_Func.readerExists(dr, "StrCheckType"))
            {
                model.StrCheckType = dr["StrCheckType"].ToDBString();
            }
            if (Common_Func.readerExists(dr, "StrCheckStatus"))
            {
                model.StrCheckStatus = dr["StrCheckStatus"].ToDBString();
            }

            model.EditText = model.CheckStatus == 1 ? "编辑" : "查看";

            return(model);
        }
Ejemplo n.º 10
0
        private UserGroupInfo GetModelFromDataReader(SqlDataReader dr)
        {
            UserGroupInfo model = new UserGroupInfo();

            model.ID               = dr["ID"].ToInt32();
            model.UserGroupNo      = dr["UserGroupNo"].ToDBString();
            model.UserGroupName    = dr["UserGroupName"].ToDBString();
            model.UserGroupAbbName = dr["UserGroupAbbName"].ToDBString();
            model.UserGroupType    = dr["UserGroupType"].ToInt32();
            model.UserGroupStatus  = dr["UserGroupStatus"].ToInt32();
            model.Description      = dr["Description"].ToDBString();
            model.IsDel            = dr["ISDEL"].ToInt32();
            model.Creater          = dr["CREATER"].ToDBString();
            model.CreateTime       = dr["CREATETIME"].ToDateTime();
            model.Modifyer         = dr["MODIFYER"].ToDBString();
            model.ModifyTime       = dr["MODIFYTIME"].ToDateTimeNull();

            if (Common_Func.readerExists(dr, "IsChecked"))
            {
                model.BIsChecked = dr["IsChecked"].ToBoolean();
            }
            if (Common_Func.readerExists(dr, "StrUserGroupType"))
            {
                model.StrUserGroupType = dr["StrUserGroupType"].ToDBString();
            }
            if (Common_Func.readerExists(dr, "StrUserGroupStatus"))
            {
                model.StrUserGroupStatus = dr["StrUserGroupStatus"].ToDBString();
            }

            return(model);
        }
Ejemplo n.º 11
0
        private string GetFilterSql(DeliveryReceiveDetail_Model model, UserInfo user)
        {
            try
            {
                string strSql   = "";
                bool   hadWhere = false;

                if (model.ID >= 1)
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " receive_id = " + model.ID + " ";
                    hadWhere = true;
                }

                if (!string.IsNullOrEmpty(model.VoucherNo))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " VoucherNo = '" + model.VoucherNo + "' ";
                    hadWhere = true;
                }

                return(strSql);
            }
            catch
            {
                return(string.Empty);
            }
        }
Ejemplo n.º 12
0
        protected override string GetFilterSql(UserModel user, T_Machine customer)
        {
            string strSql = " where nvl(isDel,0) != 2  ";
            string strAnd = " and ";

            if (!Common_Func.IsNullOrEmpty(customer.MachineCode))
            {
                strSql += strAnd;
                strSql += " (MachineCode like '%" + customer.MachineCode + "%')  ";
            }


            if (!string.IsNullOrEmpty(customer.MachineName))
            {
                strSql += strAnd;
                strSql += " MachineName like '%" + customer.MachineName + "%'";
            }

            if ((!string.IsNullOrEmpty(customer.MachineType)))
            {
                strSql += strAnd;
                strSql += " MachineType like '%" + customer.MachineType + "%'";
            }

            return(strSql);
        }
Ejemplo n.º 13
0
        private OverViewInfo GetModelFromDataReader(SqlDataReader dr)
        {
            OverViewInfo model = new OverViewInfo();

            model.ID               = dr["ID"].ToInt32();
            model.TaskNo           = dr["TaskNo"].ToDBString();
            model.VoucherType      = dr["VoucherType"].ToInt32();
            model.TaskType         = dr["TaskType"].ToInt32();
            model.SupcusNo         = dr["SupcusNo"].ToDBString();
            model.SupcusName       = dr["SupcusName"].ToDBString();
            model.TaskStatus       = dr["TaskStatus"].ToInt32();
            model.AuditUserNo      = dr["AuditUserNo"].ToDBString();
            model.AuditDateTime    = dr["AuditDateTime"].ToDateTimeNull();
            model.TaskIssued       = dr["TaskIssued"].ToDateTimeNull();
            model.ReceiveUserNo    = dr["ReceiveUserNo"].ToDBString();
            model.CreateDateTime   = dr["CreateDateTime"].ToDateTimeNull();
            model.Remark           = dr["Remark"].ToDBString();
            model.Reason           = dr["Reason"].ToDBString();
            model.CreateUserNo     = dr["CreateUserNo"].ToDBString();
            model.IsShelvePost     = dr["IsShelvePost"].ToInt32();
            model.DeliveryNo       = dr["DeliveryNo"].ToDBString();
            model.IsQuality        = dr["IsQuality"].ToInt32();
            model.IsReceivePost    = dr["IsReceivePost"].ToInt32();
            model.Plant            = dr["Plant"].ToDBString();
            model.PlantName        = dr["PlantName"].ToDBString();
            model.Receive_Id       = dr["Receive_Id"].ToInt32();
            model.StrVoucherType   = dr["StrVoucherType"].ToDBString();
            model.StrTaskType      = dr["StrTaskType"].ToDBString();
            model.StrIsQuality     = dr["StrIsQuality"].ToDBString();
            model.StrIsShelvePost  = dr["StrIsShelvePost"].ToDBString();
            model.StrIsReceivePost = dr["StrIsReceivePost"].ToDBString();
            model.StrTaskStatus    = dr["StrTaskStatus"].ToDBString();
            model.WarehouseCode    = dr["WarehouseCode"].ToDBString();
            model.WarehouseName    = dr["WarehouseName"].ToDBString();
            model.AuditUserName    = dr["AuditUserName"].ToDBString();
            model.ReceiveUserName  = dr["ReceiveUserName"].ToDBString();
            model.CreateUserName   = dr["CreateUserName"].ToDBString();
            model.PostStatus       = dr["PostStatus"].ToInt32();
            model.StrPostStatus    = dr["StrPostStatus"].ToDBString();
            if (Common_Func.readerExists(dr, "MaterialDoc"))
            {
                model.MaterialDoc = dr["MaterialDoc"].ToDBString();
            }

            model.CreateTime = model.CreateDateTime;
            switch (model.VoucherType)
            {
            case 50:
            case 60:
                if (string.IsNullOrEmpty(model.CreateUserName))
                {
                    model.ReceiveUserNo   = model.CreateUserNo;
                    model.ReceiveUserName = model.CreateUserName;
                }
                break;
            }

            return(model);
        }
Ejemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int ckint = 0;
            Common_Func cfc = new Common_Func();

            // 檢查使用者權限並存入登入紀錄
            //Check_Power("2002", true);

            #region 接受下一頁返回時的舊查詢條件
            if (Request["pageid"] != null)
            {
                if (int.TryParse(Request["pageid"], out ckint))
                {
                    if (ckint > gv_Fi_Content.PageCount)
                        ckint = gv_Fi_Content.PageCount;

                    gv_Fi_Content.PageIndex = ckint;
                }
                else
                    lb_pageid.Text = "0";
            }

            ods_Fi_Content.SelectParameters["fl_no"].DefaultValue = "2";

            if (Request["fc_name"] != null)
            {
                tb_fc_name.Text = cfc.CleanSQL(Request["fc_name"]);
                ods_Fi_Content.SelectParameters["fc_name"].DefaultValue = tb_fc_name.Text;
            }

            if (Request["fc_ext"] != null)
            {
                tb_fc_ext.Text = cfc.CleanSQL(Request["fc_ext"]);
                ods_Fi_Content.SelectParameters["fc_ext"].DefaultValue = tb_fc_ext.Text;
            }

            if (Request["fc_desc"] != null)
            {
                tb_fc_desc.Text = cfc.CleanSQL(Request["fc_desc"]);
                ods_Fi_Content.SelectParameters["fc_desc"].DefaultValue = tb_fc_desc.Text;
            }

            #endregion
        }

        #region 檢查頁數是否超過
        ods_Fi_Content.DataBind();
        gv_Fi_Content.DataBind();
        if (gv_Fi_Content.PageCount < gv_Fi_Content.PageIndex)
        {
            gv_Fi_Content.PageIndex = gv_Fi_Content.PageCount;
            gv_Fi_Content.DataBind();
        }

        lb_pageid.Text = gv_Fi_Content.PageIndex.ToString();
        #endregion
    }
Ejemplo n.º 15
0
        private string GetFilterSql(Barcode_Model model, UserInfo user)
        {
            try
            {
                string strSql   = "";
                bool   hadWhere = false;


                if (!string.IsNullOrEmpty(model.SUPCODE))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " (SUPCODE LIKE '%" + model.SUPCODE + "%' OR SUPNAME LIKE '%" + model.SUPCODE + "%') ";
                    hadWhere = true;
                }

                if (model.BARCODETYPE >= 1)
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " BARCODETYPE = '" + model.BARCODETYPE + "' ";
                    hadWhere = true;
                }

                if (!string.IsNullOrEmpty(model.VOUCHERTYPE))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " VOUCHERTYPE = '" + model.VOUCHERTYPE + "' ";
                    hadWhere = true;
                }
                else
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " (VOUCHERTYPE = '10' or VOUCHERTYPE = '70') ";
                    hadWhere = true;
                }

                if (model.StartTime != null)
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " PrintTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " ";
                    hadWhere = true;
                }

                if (model.EndTime != null)
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " PrintTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " ";
                    hadWhere = true;
                }

                strSql += " group by barcodetype, strbarcodetype, supcode, supname, vouchertype, strvouchertype ";

                return(strSql);
            }
            catch
            {
                return(string.Empty);
            }
        }
Ejemplo n.º 16
0
        private string GetFilterSql(QuanlityExportInfo model, UserInfo user)
        {
            try
            {
                string strSql   = "";
                bool   hadWhere = false;


                if (!string.IsNullOrEmpty(model.MaterialDoc))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " MaterialDoc Like '%" + model.MaterialDoc + "%' ";
                    hadWhere = true;
                }

                if (!string.IsNullOrEmpty(model.VoucherNo))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " VoucherNo Like '%" + model.VoucherNo + "%' ";
                    hadWhere = true;
                }

                if (!string.IsNullOrEmpty(model.DeliveryNo))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " DeliveryNo Like '%" + model.DeliveryNo + "%' ";
                    hadWhere = true;
                }

                if (!string.IsNullOrEmpty(model.MaterialNo))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " (MaterialNo LIKE '%" + model.MaterialNo + "%' OR MaterialDesc Like '%" + model.MaterialNo + "%') ";
                    hadWhere = true;
                }

                if (model.StartTime != null)
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " createdate >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString();
                    hadWhere = true;
                }

                if (model.EndTime != null)
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " createdate <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString();
                    hadWhere = true;
                }


                return(strSql);
            }
            catch
            {
                return(string.Empty);
            }
        }
Ejemplo n.º 17
0
        public string ChangeUserPasswordForAndroid(string strUserJson)
        {
            UserInfo user     = new UserInfo();
            string   strError = string.Empty;

            try
            {
                user = JSONHelper.JsonToObject <UserInfo>(strUserJson);

                if (user == null || user.ID == 0)
                {
                    user.Status  = "E";
                    user.Message = "用户信息获取失败!请重新登陆!";
                    return(JSONHelper.ObjectToJson(user));
                }
                if (user.Password == user.RePassword)
                {
                    user.Status     = "S";
                    user.LoginTime  = null;
                    user.CreateTime = null;
                    user.ModifyTime = null;

                    return(JSONHelper.ObjectToJson(user));
                }

                user.Modifyer = user.UserNo;
                user.Password = JiaMi(user.Password);
                //user.Password = netLogin.EnPassWord(user.Password);
                bool bResult = _db.ChangeUserPassword(user, ref strError);

                if (bResult)
                {
                    user.RePassword = user.Password;
                    user.Status     = "S";
                    user.LoginTime  = null;
                    user.CreateTime = null;
                    user.ModifyTime = null;

                    return(JSONHelper.ObjectToJson(user));
                }
                else
                {
                    user.Status  = "E";
                    user.Message = strError;
                    return(JSONHelper.ObjectToJson(user));
                }
            }
            catch (Exception ex)
            {
                user.Status  = "E";
                user.Message = "Web异常:" + ex.Message + ex.StackTrace;
                if (Common_Func.IsSqlError(user.Message, ref strError))
                {
                    user.Message = strError;
                }
                return(JSONHelper.ObjectToJson(user));
            }
        }
Ejemplo n.º 18
0
        private string GetFilterSql(UserInfo model, UserInfo user)
        {
            try
            {
                string strSql   = " Where ISNULL(IsDel,1) = 1 ";
                bool   hadWhere = true;


                if (!string.IsNullOrEmpty(model.UserNo))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " UserNo Like '%" + model.UserNo + "%' ";
                    hadWhere = true;
                }

                if (!string.IsNullOrEmpty(model.UserName))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " (UserName Like '%" + model.UserName + "%' OR PinYin Like '%" + model.UserName + "%') ";
                    hadWhere = true;
                }

                if (model.IsOnline >= 1)
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " LoginIP is " + (model.IsOnline.ToBoolean() ? "not" : "") + " null ";
                    hadWhere = true;
                }

                if (!string.IsNullOrEmpty(model.Creater))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " Creater Like '%" + model.Creater + "%' ";
                    hadWhere = true;
                }

                if (model.StartTime != null)
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " CreateTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " ";
                    hadWhere = true;
                }

                if (model.EndTime != null)
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " CreateTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " ";
                    hadWhere = true;
                }


                return(strSql);
            }
            catch
            {
                return(string.Empty);
            }
        }
Ejemplo n.º 19
0
        protected override string GetFilterSql(UserModel user, T_TransportSupDetailInfo model)
        {
            string strSql = " where isnull(isDel,0) != 2";
            string strAnd = " and ";

            if (!Common_Func.IsNullOrEmpty(model.PlateNumber))
            {
                strSql += strAnd;
                strSql += " PlateNumber LIKE '%" + model.PlateNumber + "%'  ";
            }

            if (!Common_Func.IsNullOrEmpty(model.PalletNo))
            {
                strSql += strAnd;
                //strSql += " ID In (Select WarehouseID From T_House Where HouseNo LIKE '%" + model.HouseNo + "%' OR HouseName Like '%" + model.HouseNo + "%') ";
                strSql += " PalletNo LIKE '%" + model.PalletNo + "%' ";
            }

            if (!Common_Func.IsNullOrEmpty(model.ErpVoucherNo))
            {
                strSql += strAnd;
                strSql += " ErpVoucherNo LIKE '%" + model.ErpVoucherNo + "%' ";
            }

            if (!Common_Func.IsNullOrEmpty(model.strType))
            {
                strSql += strAnd;
                strSql += " strType = '" + model.strType + "' ";
            }

            if (!Common_Func.IsNullOrEmpty(model.VoucherNo))
            {
                strSql += strAnd;
                strSql += " VoucherNo = '" + model.VoucherNo + "' ";
            }


            if (!Common_Func.IsNullOrEmpty(model.Creater))
            {
                strSql += strAnd;
                strSql += " Creater Like '%" + model.Creater + "%' ";
            }

            if (model.DateFrom != null)
            {
                strSql += strAnd;
                strSql += " CreateTime >= " + model.DateFrom.ToDateTime().Date.ToOracleTimeString() + "  ";
            }

            if (model.DateTo != null)
            {
                strSql += strAnd;
                strSql += " CreateTime <= " + model.DateTo.ToDateTime().AddDays(1).Date.ToOracleTimeString() + " ";
            }

            return(strSql);
        }
Ejemplo n.º 20
0
        private void ClearLoginInfo()
        {
            if (!Common_Func.CheckDgvOper(dgvList))
            {
                return;
            }

            ClearListModel(dgvList.SelectedRows[0].Index);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 将获取的单条数据转封装成对象返回
        /// </summary>
        protected override T_WareHouseInfo ToModel(IDataReader reader)
        {
            T_WareHouseInfo t_warehouse = new T_WareHouseInfo();

            t_warehouse.ID              = dbFactory.ToModelValue(reader, "ID").ToInt32();
            t_warehouse.WareHouseNo     = (string)dbFactory.ToModelValue(reader, "WAREHOUSENO");
            t_warehouse.WareHouseName   = (string)dbFactory.ToModelValue(reader, "WAREHOUSENAME");
            t_warehouse.WareHouseType   = dbFactory.ToModelValue(reader, "WAREHOUSETYPE").ToInt32();
            t_warehouse.ContactUser     = (string)dbFactory.ToModelValue(reader, "CONTACTUSER");
            t_warehouse.ContactPhone    = (string)dbFactory.ToModelValue(reader, "CONTACTPHONE");
            t_warehouse.HouseCount      = dbFactory.ToModelValue(reader, "HOUSECOUNT").ToInt32();
            t_warehouse.HouseUsingCount = dbFactory.ToModelValue(reader, "HOUSEUSINGCOUNT").ToInt32();
            t_warehouse.Address         = (string)dbFactory.ToModelValue(reader, "ADDRESS");
            t_warehouse.LocationDesc    = (string)dbFactory.ToModelValue(reader, "LOCATIONDESC");
            t_warehouse.WareHouseStatus = dbFactory.ToModelValue(reader, "WAREHOUSESTATUS").ToInt32();
            t_warehouse.IsDel           = dbFactory.ToModelValue(reader, "ISDEL").ToDecimal();
            t_warehouse.Creater         = (string)dbFactory.ToModelValue(reader, "CREATER");
            t_warehouse.CreateTime      = (DateTime?)dbFactory.ToModelValue(reader, "CREATETIME");
            t_warehouse.Modifyer        = (string)dbFactory.ToModelValue(reader, "MODIFYER");
            t_warehouse.ModifyTime      = (DateTime?)dbFactory.ToModelValue(reader, "MODIFYTIME");

            if (Common_Func.readerExists(reader, "IsChecked"))
            {
                t_warehouse.BIsChecked = reader["IsChecked"].ToBoolean();
            }
            if (Common_Func.readerExists(reader, "StrWarehouseStatus"))
            {
                t_warehouse.StrWarehouseStatus = reader["StrWarehouseStatus"].ToDBString();
            }
            if (Common_Func.readerExists(reader, "AreaCount"))
            {
                t_warehouse.AreaCount = reader["AreaCount"].ToInt32();
            }
            if (Common_Func.readerExists(reader, "AreaUsingCount"))
            {
                t_warehouse.AreaUsingCount = reader["AreaUsingCount"].ToInt32();
            }

            t_warehouse.HouseRate = t_warehouse.HouseCount >= 1 ? t_warehouse.HouseUsingCount.ToDecimal() / t_warehouse.HouseCount.ToDecimal() : 0;
            t_warehouse.AreaRate  = t_warehouse.AreaCount >= 1 ? t_warehouse.AreaUsingCount.ToDecimal() / t_warehouse.AreaCount.ToDecimal() : 0;

            t_warehouse.StrCreateTime = t_warehouse.CreateTime.ToShowTime();
            t_warehouse.StrModifyTime = t_warehouse.ModifyTime.ToShowTime();

            t_warehouse.SamplerCode = dbFactory.ToModelValue(reader, "Samplercode").ToDBString();
            t_warehouse.SamplerName = dbFactory.ToModelValue(reader, "Samplername").ToDBString();

            t_warehouse.DisplayID     = t_warehouse.WareHouseNo;
            t_warehouse.DisplayName   = t_warehouse.WareHouseName;
            t_warehouse.ISVWAREHOUSE  = dbFactory.ToModelValue(reader, "ISVWAREHOUSE").ToInt32();
            t_warehouse.DefaultAreaNo = dbFactory.ToModelValue(reader, "DefaultAreaNo").ToDBString();
            t_warehouse.ZhAreaNo      = dbFactory.ToModelValue(reader, "ZhAreaNo").ToDBString();
            t_warehouse.FixAreaNo     = dbFactory.ToModelValue(reader, "FixAreaNo").ToDBString();
            t_warehouse.ZCAreaNo      = dbFactory.ToModelValue(reader, "ZCAreaNo").ToDBString();

            return(t_warehouse);
        }
Ejemplo n.º 22
0
        private bool CheckInput()
        {
            if (_recheck.lstDetails == null || _recheck.lstDetails.Count <= 0)
            {
                return(Common_Func.ErrorMessage("盘点信息必须勾选", "保存失败", 2));
            }

            return(true);
        }
Ejemplo n.º 23
0
        protected override string GetFilterSql(UserModel user, UserInfo model)
        {
            string strSql = base.GetFilterSql(user, model);
            string strAnd = " and ";


            if (!Common_Func.IsNullOrEmpty(model.UserNo))
            {
                strSql += strAnd;
                strSql += " (USERNO like '%" + model.UserNo + "%')  ";
            }

            if (!Common_Func.IsNullOrEmpty(model.UserName))
            {
                strSql += strAnd;
                strSql += " (UserName like '%" + model.UserName + "%')  ";
            }

            if (model.IsOnline >= 1)
            {
                strSql += strAnd;
                strSql += " LoginIP is " + (model.IsOnline.ToBoolean() ? "not" : "") + " null ";
            }

            if (!string.IsNullOrEmpty(model.Creater))
            {
                strSql += strAnd;
                strSql += " Creater Like '%" + model.Creater + "%' ";
            }

            if (model.DateFrom != null)
            {
                strSql += strAnd;
                strSql += " CreateTime " + this.GetDateFromFilter(model);
            }

            if (model.DateTo != null)
            {
                strSql += strAnd;
                strSql += " CreateTime  " + this.GetDateToFilter(model);
            }

            if (model.IsPick > 0)
            {
                strSql += strAnd;
                strSql += " IsPick ='" + model.IsPick + "' ";
            }

            if (model.LoginTime != null)
            {
                strSql += strAnd;
                strSql += " isnull(LoginTime,'') <> '' ";
            }


            return(strSql);
        }
Ejemplo n.º 24
0
        protected override string GetFilterSql(UserModel user, T_MaterialInfo model)
        {
            string strSql = string.Empty;
            string strAnd = " and ";

            strSql += base.GetFilterSql(user, model);

            if (!Common_Func.IsNullOrEmpty(model.MaterialNo))
            {
                strSql += strAnd;
                strSql += " (MaterialNo LIKE '" + model.MaterialNo + "%' )  ";
            }

            if (!Common_Func.IsNullOrEmpty(model.MaterialDesc))
            {
                strSql += strAnd;
                strSql += " MaterialDesc Like '" + model.MaterialDesc + "%'";
            }

            if (!Common_Func.IsNullOrEmpty(model.SupplierNo))
            {
                strSql += strAnd;
                strSql += "( SupplierNo Like '" + model.SupplierNo + "%'  or SupplierName Like '" + model.SupplierNo + "%' )";
            }

            if (model.DateFrom != null)
            {
                strSql += strAnd;
                strSql += " CreateTime >= " + model.DateFrom.ToDateTime().Date.AddDays(-1).ToOracleTimeString() + "  ";
            }

            if (model.DateTo != null)
            {
                strSql += strAnd;
                strSql += " CreateTime <= " + model.DateTo.ToDateTime().Date.AddDays(1).ToOracleTimeString() + " ";
            }

            if (!string.IsNullOrEmpty(model.BatchNo))
            {
                strSql += strAnd;
                strSql += " Batchno = '" + model.BatchNo + "' ";
            }

            if (!string.IsNullOrEmpty(model.WareHouseNo))
            {
                strSql += strAnd;
                strSql += " WareHouseNo = '" + model.WareHouseNo + "' ";
            }

            if (!string.IsNullOrEmpty(model.AreaNo))
            {
                strSql += strAnd;
                strSql += " AreaNo = '" + model.AreaNo + "' ";
            }

            return(strSql);
        }
Ejemplo n.º 25
0
    protected void lb_ok_Click(object sender, EventArgs e)
    {
        string mErr = "";
        string mg_pass, mg_pass1;

        // 載入公用函數
        Common_Func cfc = new Common_Func();

        mg_pass = tb_mg_pass.Text.Trim();
        mg_pass1 = tb_mg_pass1.Text.Trim();

        if (mg_pass == "")
            mErr = mErr + "「新登入密碼」沒有輸入!\\n";
        else
            if (cfc.CheckSQL(mg_pass))
                mErr = mErr + "「新登入密碼」請勿使用特殊符號!\\n";
            else if (mg_pass.Length > 12 || mg_pass.Length < 4)
                mErr = mErr + "「新登入密碼」長度為4~12個字!\\n";

        if (mg_pass != mg_pass1)
            mErr = mErr + "「新登入密碼」與「新密碼確認」不相同!\\n";

        if (mErr == "")
        {
            using (SqlConnection Sql_conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["AppSysConnectionString"].ConnectionString))
            {
                string SqlString = "";
                Decoder decoder = new Decoder();

                Sql_conn.Open();

                // 建立 SQL 修改資料的語法
                SqlString = "Update Manager Set mg_pass = @mg_pass";
                SqlString = SqlString + " Where mg_sid = @mg_sid";

                using (SqlCommand Sql_Command = new SqlCommand(SqlString, Sql_conn))
                {
                    Sql_Command.Parameters.AddWithValue("@mg_pass", decoder.EnCode(mg_pass));
                    Sql_Command.Parameters.AddWithValue("@mg_sid", lb_pg_mg_sid.Text);

                    Sql_Command.ExecuteNonQuery();
                }
            }
        }

        if (mErr == "")
        {
            mErr = "alert('密碼變更完成,新密碼該員於下次登入時生效!\\n');location.replace('10051.aspx" + lb_page.Text + "');";
        }
        else
            mErr = "alert('" + mErr + "')";

        lt_show.Text = "<script language=javascript>" + mErr + "</script>";
    }
Ejemplo n.º 26
0
        /// <summary>
        /// 将获取的单条数据转封装成对象返回
        /// </summary>
        protected override T_HouseInfo ToModel(IDataReader reader)
        {
            T_HouseInfo t_house = new T_HouseInfo();

            t_house.ID             = dbFactory.ToModelValue(reader, "ID").ToInt32();
            t_house.HouseNo        = (string)dbFactory.ToModelValue(reader, "HOUSENO");
            t_house.HouseName      = (string)dbFactory.ToModelValue(reader, "HOUSENAME");
            t_house.HouseType      = dbFactory.ToModelValue(reader, "HOUSETYPE").ToInt32();
            t_house.ContactUser    = (string)dbFactory.ToModelValue(reader, "CONTACTUSER");
            t_house.ContactPhone   = (string)dbFactory.ToModelValue(reader, "CONTACTPHONE");
            t_house.AreaCount      = dbFactory.ToModelValue(reader, "AREACOUNT").ToInt32();
            t_house.AreaUsingCount = dbFactory.ToModelValue(reader, "AREAUSINGCOUNT").ToInt32();
            t_house.Address        = (string)dbFactory.ToModelValue(reader, "ADDRESS");
            t_house.LocationDesc   = (string)dbFactory.ToModelValue(reader, "LOCATIONDESC");
            t_house.HouseStatus    = dbFactory.ToModelValue(reader, "HOUSESTATUS").ToInt32();
            t_house.WarehouseID    = dbFactory.ToModelValue(reader, "WAREHOUSEID").ToInt32();
            t_house.IsDel          = dbFactory.ToModelValue(reader, "ISDEL").ToInt32();
            t_house.Creater        = (string)dbFactory.ToModelValue(reader, "CREATER");
            t_house.CreateTime     = (DateTime?)dbFactory.ToModelValue(reader, "CREATETIME");
            t_house.Modifyer       = (string)dbFactory.ToModelValue(reader, "MODIFYER");
            t_house.ModifyTime     = (DateTime?)dbFactory.ToModelValue(reader, "MODIFYTIME");


            if (Common_Func.readerExists(reader, "WarehouseNo"))
            {
                t_house.WarehouseNo = reader["WarehouseNo"].ToDBString();
            }
            if (Common_Func.readerExists(reader, "WarehouseName"))
            {
                t_house.WarehouseName = reader["WarehouseName"].ToDBString();
            }
            if (Common_Func.readerExists(reader, "StrHouseStatus"))
            {
                t_house.StrHouseStatus = reader["StrHouseStatus"].ToDBString();
            }
            if (Common_Func.readerExists(reader, "StrHouseType"))
            {
                t_house.StrHouseType = reader["StrHouseType"].ToDBString();
            }
            if (Common_Func.readerExists(reader, "StrFloorType"))
            {
                t_house.StrFloorType = reader["StrFloorType"].ToDBString();
            }

            t_house.AreaRate = t_house.AreaCount >= 1 ? t_house.AreaUsingCount.ToDecimal() / t_house.AreaCount.ToDecimal() : 0;

            t_house.FloorType         = dbFactory.ToModelValue(reader, "FloorType").ToInt32();
            t_house.MaterialClassCode = dbFactory.ToModelValue(reader, "MaterialClassCode").ToDBString();
            t_house.MaterialClassName = dbFactory.ToModelValue(reader, "MaterialClassName").ToDBString();
            t_house.HouseProp         = dbFactory.ToModelValue(reader, "HouseProp").ToInt32();
            t_house.StrHouseProp      = dbFactory.ToModelValue(reader, "StrHouseProp").ToDBString();

            return(t_house);
        }
Ejemplo n.º 27
0
        protected override string GetFilterSql(UserModel user, T_TransportSupplier model)
        {
            string strSql = base.GetFilterSql(user, model);
            string strAnd = " and ";

            if (!Common_Func.IsNullOrEmpty(model.TransportSupplierID.ToString()) || !Common_Func.IsNullOrEmpty(model.TransportSupplierName.ToString()))
            {
                strSql += strAnd;
                strSql += " (Transportsupplierid LIKE '%" + model.TransportSupplierID + "%' OR TransportSupplierName Like '%" + model.TransportSupplierName + "%')  ";
            }
            return(strSql);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 将获取的单条数据转封装成对象返回
        /// </summary>
        protected override T_QualityDetailInfo ToModel(IDataReader reader)
        {
            T_QualityDetailInfo t_qualitydetail = new T_QualityDetailInfo();

            t_qualitydetail.ID = dbFactory.ToModelValue(reader, "ID").ToInt32();
            //t_qualitydetail.ErpVoucherNo = (string)dbFactory.ToModelValue(reader, "ERPVOUCHERNO");
            t_qualitydetail.StrongHoldCode = (string)dbFactory.ToModelValue(reader, "STRONGHOLDCODE");
            t_qualitydetail.StrongHoldName = (string)dbFactory.ToModelValue(reader, "STRONGHOLDNAME");
            t_qualitydetail.CompanyCode    = (string)dbFactory.ToModelValue(reader, "COMPANYCODE");
            t_qualitydetail.ERPCreater     = (string)dbFactory.ToModelValue(reader, "ERPCREATER");
            t_qualitydetail.VouDate        = (DateTime?)dbFactory.ToModelValue(reader, "VOUDATE");
            t_qualitydetail.VouUser        = (string)dbFactory.ToModelValue(reader, "VOUUSER");
            t_qualitydetail.ERPStatus      = dbFactory.ToModelValue(reader, "ERPSTATUS").ToDBString();
            t_qualitydetail.ERPNote        = (string)dbFactory.ToModelValue(reader, "ERPNOTE");
            t_qualitydetail.CreateTime     = (DateTime?)dbFactory.ToModelValue(reader, "CREATETIME");
            t_qualitydetail.Creater        = (string)dbFactory.ToModelValue(reader, "CREATER");
            t_qualitydetail.Modifyer       = (string)dbFactory.ToModelValue(reader, "MODIFYER");
            t_qualitydetail.ModifyTime     = (DateTime?)dbFactory.ToModelValue(reader, "MODIFYTIME");
            t_qualitydetail.Status         = dbFactory.ToModelValue(reader, "STATUS").ToInt32();
            t_qualitydetail.TimeStamp      = (DateTime?)dbFactory.ToModelValue(reader, "TIMESTAMP");
            t_qualitydetail.IsDel          = dbFactory.ToModelValue(reader, "ISDEL").ToInt32();

            t_qualitydetail.NoticeStatus   = dbFactory.ToModelValue(reader, "NOTICESTATUS").ToInt32();
            t_qualitydetail.QualityType    = dbFactory.ToModelValue(reader, "QUALITYTYPE").ToInt32();
            t_qualitydetail.MaterialNo     = (string)dbFactory.ToModelValue(reader, "MATERIALNO");
            t_qualitydetail.MaterialDesc   = (string)dbFactory.ToModelValue(reader, "MATERIALDESC");
            t_qualitydetail.InSQty         = (decimal?)dbFactory.ToModelValue(reader, "INSQTY");
            t_qualitydetail.Unit           = (string)dbFactory.ToModelValue(reader, "UNIT");
            t_qualitydetail.UnitName       = (string)dbFactory.ToModelValue(reader, "UNITNAME");
            t_qualitydetail.QuanQty        = (decimal?)dbFactory.ToModelValue(reader, "QUANQTY");
            t_qualitydetail.UnQuanQty      = (decimal?)dbFactory.ToModelValue(reader, "UNQUANQTY");
            t_qualitydetail.DesQty         = (decimal?)dbFactory.ToModelValue(reader, "DESQTY");
            t_qualitydetail.WarehouseNo    = (string)dbFactory.ToModelValue(reader, "WAREHOUSENO");
            t_qualitydetail.BatchNo        = (string)dbFactory.ToModelValue(reader, "BATCHNO");
            t_qualitydetail.ErpVoucherNo   = (string)dbFactory.ToModelValue(reader, "ErpVoucherNo");
            t_qualitydetail.ErpInVoucherNo = (string)dbFactory.ToModelValue(reader, "inerpvoucherno");
            //t_qualitydetail.SampQty = (decimal)dbFactory.ToModelValue(reader, "SampQty");
            t_qualitydetail.RemainQty    = (decimal?)dbFactory.ToModelValue(reader, "RemainQty");
            t_qualitydetail.QuanQty      = (decimal?)dbFactory.ToModelValue(reader, "QuanQty");
            t_qualitydetail.UnQuanQty    = (decimal?)dbFactory.ToModelValue(reader, "UnQuanQty");
            t_qualitydetail.MaterialNoID = dbFactory.ToModelValue(reader, "MaterialNoID").ToInt32();

            if (Common_Func.readerExists(reader, "Areano"))
            {
                t_qualitydetail.AreaNo = (string)dbFactory.ToModelValue(reader, "Areano");
            }
            if (Common_Func.readerExists(reader, "AreaType"))
            {
                t_qualitydetail.AreaType = reader["AreaType"].ToInt32();
            }

            return(t_qualitydetail);
        }
Ejemplo n.º 29
0
        private void BindComboboxs()
        {
            Common_Func.BindComboBoxAddAll(Task_Func.GetIsQuality(), cbbIsQuality);

            Common_Func.BindComboBoxAddAll(Task_Func.GetTaskStatus(true), cbbTaskStatus);

            Common_Func.BindComboBoxAddAll(Task_Func.GetOrderType(true), cbbVoucherType);

            Common_Func.BindComboBoxAddAll(Task_Func.GetPostStatus(), cbbPostStatus);

            Common_Func.BindComboBoxAddAllByKey(cbbWarehouse.Name, cbbWarehouse);
        }
Ejemplo n.º 30
0
        protected override bool CheckModelBeforeSave(T_DepInterfaceInfo model, ref string strError)
        {
            if (model == null)
            {
                strError = "客户端传来的实体类不能为空!";
                return(false);
            }

            if (model.VoucherName == 0)
            {
                strError = "请先选择单据名称!";
                return(false);
            }

            if (model.VoucherType == 0)
            {
                strError = "请先选择单据类型!";
                return(false);
            }

            if (model.Function == 0)
            {
                strError = "请先选择功能!";
                return(false);
            }

            if (Common_Func.IsNullOrEmpty(model.Route))
            {
                strError = "请先输入DLL文件路径!";
                return(false);
            }

            if (Common_Func.IsNullOrEmpty(model.ClassName))
            {
                strError = "请先输入类名!";
                return(false);
            }

            if (Common_Func.IsNullOrEmpty(model.DLLName))
            {
                strError = "请先输入DLL文件名称!";
                return(false);
            }

            if (Common_Func.IsNullOrEmpty(model.FunctionName))
            {
                strError = "请先输入函数名称!";
                return(false);
            }

            return(true);
        }
Ejemplo n.º 31
0
        private string GetFilterSql(MenuInfo model, UserInfo user)
        {
            try
            {
                string strSql   = " Where ISNULL(IsDel,1) = 1 ";
                bool   hadWhere = true;


                if (!string.IsNullOrEmpty(model.MenuNo))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " MenuNo Like '%" + model.MenuNo + "%' ";
                    hadWhere = true;
                }

                if (!string.IsNullOrEmpty(model.MenuName))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " MenuName Like '%" + model.MenuName + "%' ";
                    hadWhere = true;
                }

                if (!string.IsNullOrEmpty(model.Creater))
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " Creater Like '%" + model.Creater + "%' ";
                    hadWhere = true;
                }

                if (model.StartTime != null)
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " CreateTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " ";
                    hadWhere = true;
                }

                if (model.EndTime != null)
                {
                    strSql   = Common_Func.AddWhereAnd(strSql, hadWhere);
                    strSql  += " CreateTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " ";
                    hadWhere = true;
                }


                return(strSql);
            }
            catch
            {
                return(string.Empty);
            }
        }
Ejemplo n.º 32
0
        protected override bool CheckModelBeforeSave(UserInfo model, ref string strError)
        {
            if (model == null)
            {
                strError = "客户端传来的实体类不能为空!";
                return(false);
            }

            if (model.UserStatus <= 0)
            {
                strError = "用户状态必须选择!";
                return(false);
            }

            if (model.UserType <= 0)
            {
                strError = "用户类型必须选择!";
                return(false);
            }


            if (BILBasic.Common.Common_Func.IsNullOrEmpty(model.UserNo))
            {
                strError = "登录名不能为空!";
                return(false);
            }
            if (Common_Func.IsNullOrEmpty(model.UserName))
            {
                strError = "用户姓名不能为空!";
                return(false);
            }
            if (Common_Func.IsNullOrEmpty(model.PassWord) || Common_Func.IsNullOrEmpty(model.RePassword))
            {
                strError = "登陆密码和确认密码不能为空!";
                return(false);
            }

            //if (Common_Func.IsNullOrEmpty(model.GroupCode))
            //{
            //    strError = "用户分组不能为空!";
            //    return false;
            //}
            if (!Common_Func.IsEqualString(model.PassWord, model.RePassword))
            {
                strError = "确认密码与登陆密码不一致!";
                return(false);
            }


            return(true);
        }
Ejemplo n.º 33
0
    // 檢查使用者權限並存入登入紀錄
    private void Check_Power(string f_power, bool bl_save)
    {
        // 載入公用函數
        Common_Func cfc = new Common_Func();

        // 若 Session 不存在則直接顯示錯誤訊息
        try
        {
            if (cfc.Check_Power(Session["mg_sid"].ToString(), Session["mg_name"].ToString(), Session["mg_power"].ToString(), f_power, Request.ServerVariables["REMOTE_ADDR"], bl_save) > 0)
                Response.Redirect("../Error.aspx?ErrCode=1");
        }
        catch
        {
            Response.Redirect("../Error.aspx?ErrCode=2");
        }
    }
Ejemplo n.º 34
0
    // 檢查查詢條件是否改變
    private void Chk_Filter()
    {
        Common_Func cfc = new Common_Func();
        DateTime cktime;
        int ckint;

        if (! DateTime.TryParse(tb_btime.Text, out cktime))
            tb_btime.Text = "";
        ods_Mg_Log.SelectParameters["btime"].DefaultValue = tb_btime.Text;

        if (! DateTime.TryParse(tb_etime.Text, out cktime))
            tb_etime.Text = "";
        ods_Mg_Log.SelectParameters["etime"].DefaultValue = tb_etime.Text;

        if (! int.TryParse(tb_mg_sid.Text,out ckint))
            tb_mg_sid.Text = "";
        ods_Mg_Log.SelectParameters["mg_sid"].DefaultValue = tb_mg_sid.Text;

        tb_mg_name.Text = cfc.CleanSQL(tb_mg_name.Text);
        ods_Mg_Log.SelectParameters["mg_name"].DefaultValue = tb_mg_name.Text;

        tb_fi_name1.Text = cfc.CleanSQL(tb_fi_name1.Text);
        ods_Mg_Log.SelectParameters["fi_name1"].DefaultValue = tb_fi_name1.Text;

        tb_fi_name2.Text = cfc.CleanSQL(tb_fi_name2.Text);
        ods_Mg_Log.SelectParameters["fi_name2"].DefaultValue = tb_fi_name2.Text;

        tb_lg_ip.Text = cfc.CleanSQL(tb_lg_ip.Text);
        ods_Mg_Log.SelectParameters["lg_ip"].DefaultValue = tb_lg_ip.Text;

        gv_Mg_Log.DataBind();
        if (gv_Mg_Log.PageCount - 1 < gv_Mg_Log.PageIndex)
        {
            gv_Mg_Log.PageIndex = gv_Mg_Log.PageCount;
            gv_Mg_Log.DataBind();
        }
    }
Ejemplo n.º 35
0
    // 檢查查詢條件是否改變
    private void Chk_Filter()
    {
        Common_Func cfc = new Common_Func();

        DateTime ckbtime, cketime;
        string tmpstr = "";

        // 有輸入 ff_desc,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_ff_desc.Text.Trim());
        if (tmpstr != "")
            ods_Fm_Forum.SelectParameters["ff_desc"].DefaultValue = tmpstr;
        else
        {
            tb_ff_desc.Text = "";
            ods_Fm_Forum.SelectParameters["ff_desc"].DefaultValue = "";
        }

        // 有輸入 ff_name,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_ff_name.Text.Trim());
        if (tmpstr != "")
            ods_Fm_Forum.SelectParameters["ff_name"].DefaultValue = tmpstr;
        else
        {
            tb_ff_name.Text = "";
            ods_Fm_Forum.SelectParameters["ff_name"].DefaultValue = "";
        }

        // 有輸入 ff_topic,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_ff_topic.Text.Trim());
        if (tmpstr != "")
            ods_Fm_Forum.SelectParameters["ff_topic"].DefaultValue = tmpstr;
        else
        {
            tb_ff_topic.Text = "";
            ods_Fm_Forum.SelectParameters["ff_topic"].DefaultValue = "";
        }

        // 有輸入 btime 範圍,則設定條件
        if (DateTime.TryParse(tb_btime.Text.Trim(), out ckbtime))
            ods_Fm_Forum.SelectParameters["btime"].DefaultValue = ckbtime.ToString("yyyy/MM/dd HH:mm:ss");
        else
        {
            tb_btime.Text = "";
            ods_Fm_Forum.SelectParameters["btime"].DefaultValue = "";
        }

        // 有輸入 etime 範圍,則設定條件
        if (DateTime.TryParse(tb_etime.Text.Trim(), out cketime))
            ods_Fm_Forum.SelectParameters["etime"].DefaultValue = cketime.ToString("yyyy/MM/dd HH:mm:ss");
        else
        {
            tb_etime.Text = "";
            ods_Fm_Forum.SelectParameters["etime"].DefaultValue = "";
        }

        gv_Fm_Forum.DataBind();
        if (gv_Fm_Forum.PageCount - 1 < gv_Fm_Forum.PageIndex)
        {
            gv_Fm_Forum.PageIndex = gv_Fm_Forum.PageCount;
            gv_Fm_Forum.DataBind();
        }
    }
    // 產生對應的 Sql Where 字串
    private string GetSqlString(string is_close, string mb_name, string mb_email, string mb_desc, string btime, string etime)
    {
        StringBuilder sbstring = new StringBuilder();
        Common_Func cfc = new Common_Func();
        string subSql = "", tmpstr = "";
        int ckint = 0;
        DateTime cktime;

        // 檢查 is_close 是否有值
        if (int.TryParse(is_close, out ckint))
            subSql += " And is_close = " + ckint.ToString();

        // 檢查 mb_name 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(mb_name);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@mb_name+'%」 的方式
            subSql += " And mb_name Like '%'+@mb_name+'%'";
            sbstring.Append("@mb_name");
        }

        // 檢查 mb_email 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(mb_email);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@mb_email+'%」 的方式
            subSql += " And mb_email Like '%'+@mb_email+'%'";
            sbstring.Append("@mb_email");
        }

        // 檢查 mb_desc 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(mb_desc);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@mb_desc+'%」 的方式
            subSql += " And mb_desc Like '%'+@mb_desc+'%'";
            sbstring.Append("@mb_desc");
        }

        // 檢查 mb_time 開始範圍是否有值
        if (DateTime.TryParse(btime, out cktime))
            subSql += " And mb_time >= '" + cktime.ToString("yyyy/MM/dd HH:mm:ss") + "'";

        // 檢查 bh_time 結束範圍是否有值
        if (DateTime.TryParse(etime, out cktime))
            subSql += " And mb_time <= '" + cktime.ToString("yyyy/MM/dd HH:mm:ss") + "'";

        ParaString = sbstring.ToString();

        if (subSql != "")
            subSql = " Where" + subSql.Substring(4);

        return subSql;
    }
Ejemplo n.º 37
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int ckint = 0;
            Common_Func cfc = new Common_Func();
            string tmpstr = "";

            // 檢查使用者權限並存入登入紀錄
            //Check_Power("B003", true);

            #region 接受下一頁返回時的舊查詢條件
            if (Request["pageid"] != null)
            {
                if (int.TryParse(Request["pageid"], out ckint))
                {
                    if (ckint > gv_Ts_Paper.PageCount)
                        ckint = gv_Ts_Paper.PageCount;

                    gv_Ts_Paper.PageIndex = ckint;
                }
                else
                    lb_pageid.Text = "0";
            }

            if (Request["tp_sid"] != null)
            {
                if (int.TryParse(Request["tp_sid"], out ckint))
                {
                    tb_tp_sid.Text = ckint.ToString();
                    ods_Ts_Paper.SelectParameters["tp_sid"].DefaultValue = ckint.ToString();
                }
            }

            if (Request["tp_title"] != null)
            {
                tmpstr = cfc.CleanSQL(Request["tp_title"].Trim());
                if (tmpstr != "")
                {
                    tb_tp_title.Text = tmpstr;
                    ods_Ts_Paper.SelectParameters["tp_title"].DefaultValue = tmpstr;
                }
                else
                {
                    tb_tp_title.Text = "";
                    ods_Ts_Paper.SelectParameters["tp_title"].DefaultValue = "";
                }
            }

            // 限制開放及截止時間在範圍內
            ods_Ts_Paper.SelectParameters["btime"].DefaultValue = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            ods_Ts_Paper.SelectParameters["etime"].DefaultValue = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

            // 限制顯示旗標為 1 的才出現
            ods_Ts_Paper.SelectParameters["is_show"].DefaultValue = "1";
            #endregion
        }

        #region 檢查頁數是否超過
        ods_Ts_Paper.DataBind();
        gv_Ts_Paper.DataBind();
        if (gv_Ts_Paper.PageCount < gv_Ts_Paper.PageIndex)
        {
            gv_Ts_Paper.PageIndex = gv_Ts_Paper.PageCount;
            gv_Ts_Paper.DataBind();
        }

        lb_pageid.Text = gv_Ts_Paper.PageIndex.ToString();
        #endregion
    }
    // 產生對應的 Sql Where 字串
    private string GetSqlString(string he_sid, string he_title, string he_desc, string btime, string etime)
    {
        StringBuilder sbstring = new StringBuilder();
        Common_Func cfc = new Common_Func();
        string subSql = "", tmpstr = "";
        int ckint = 0;
        DateTime cktime;

        // 檢查 he_sid 是否有值
        if (int.TryParse(he_sid, out ckint))
        {
            subSql += " And he_sid = " + ckint.ToString();
        }

        // 檢查 he_title 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(he_title);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@he_title+'%」 的方式
            subSql += " And he_title Like '%'+@he_title+'%'";
            sbstring.Append("@he_title");
        }

        // 檢查 he_desc 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(he_desc);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@he_desc+'%」 的方式
            subSql += " And he_desc Like '%'+@he_desc+'%'";
            sbstring.Append("@he_desc");
        }

        // 檢查異動時間開始範圍是否有值
        if (DateTime.TryParse(btime, out cktime))
            subSql += " And init_time >= '" + cktime.ToString("yyyy/MM/dd HH:mm:ss") + "'";

        // 檢查異動時間結束範圍是否有值
        if (DateTime.TryParse(etime, out cktime))
            subSql += " And init_time <= '" + cktime.ToString("yyyy/MM/dd HH:mm:ss") + "'";

        if (subSql != "")
            subSql = " Where" + subSql.Substring(4);

        ParaString = sbstring.ToString();

        return subSql;
    }
Ejemplo n.º 39
0
    // 檢查查詢條件是否改變
    private void Chk_Filter()
    {
        Common_Func cfc = new Common_Func();

        int ckint = 0;
        DateTime ckbtime, cketime;
        string tmpstr = "";

        // 有輸入編號,則設定條件
        if (int.TryParse(tb_bh_sid.Text.Trim(), out ckint))
            ods_Bt_Head.SelectParameters["bh_sid"].DefaultValue = ckint.ToString();
        else
        {
            tb_bh_sid.Text = "";
            ods_Bt_Head.SelectParameters["bh_sid"].DefaultValue = "";
        }

        // 有輸入 bh_title,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_bh_title.Text.Trim());
        if (tmpstr != "")
            ods_Bt_Head.SelectParameters["bh_title"].DefaultValue = tmpstr;
        else
        {
            tb_bh_title.Text = "";
            ods_Bt_Head.SelectParameters["bh_title"].DefaultValue = "";
        }

        // 檢查 rb_is_check
        if (rb_is_check_all.Checked)
            ods_Bt_Head.SelectParameters["is_check"].DefaultValue = "";
        else
        {
            if (rb_is_check0.Checked)
                ods_Bt_Head.SelectParameters["is_check"].DefaultValue = "0";
            else
                ods_Bt_Head.SelectParameters["is_check"].DefaultValue = "1";
        }

        // 有輸入最後投票時間開始範圍,則設定條件
        if (DateTime.TryParse(tb_btime.Text.Trim(), out ckbtime))
            ods_Bt_Head.SelectParameters["btime"].DefaultValue = ckbtime.ToString("yyyy/MM/dd HH:mm:ss");
        else
        {
            tb_btime.Text = "";
            ods_Bt_Head.SelectParameters["btime"].DefaultValue = "";
        }

        // 有輸入最後投票時間結束範圍,則設定條件
        if (DateTime.TryParse(tb_etime.Text.Trim(), out cketime))
            ods_Bt_Head.SelectParameters["etime"].DefaultValue = cketime.ToString("yyyy/MM/dd HH:mm:ss");
        else
        {
            tb_etime.Text = "";
            ods_Bt_Head.SelectParameters["etime"].DefaultValue = "";
        }

        gv_Bt_Head.DataBind();
        if (gv_Bt_Head.PageCount - 1 < gv_Bt_Head.PageIndex)
        {
            gv_Bt_Head.PageIndex = gv_Bt_Head.PageCount;
            gv_Bt_Head.DataBind();
        }
    }
Ejemplo n.º 40
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string mErr = "";
        int ckint = 0;
        Common_Func cfc = new Common_Func();
        DateTime ckbtime, cketime;

        if (!IsPostBack)
        {
            // 檢查使用者權限並存入登入紀錄
            //Check_Power("9001", true);

            #region 檢查接收參數
            if (Request["sid"] == null)
            {
                mErr = "參數傳送錯誤!\\n";
            }
            else
            {
                if (int.TryParse(Request["sid"], out ckint))
                {
                    lb_adm_sid.Text = ckint.ToString();
                    ods_Ad_List.SelectParameters["adm_sid"].DefaultValue = ckint.ToString();
                    ods_Ad_List.UpdateParameters["adm_sid"].DefaultValue = ckint.ToString();
                    ods_Ad_List.InsertParameters["adm_sid"].DefaultValue = ckint.ToString();

                    Get_Data();
                }
                else
                    mErr = "參數傳送錯誤!\\n";
            }
            #endregion

            if (mErr == "")
            {
                #region 承接上一頁的查詢條件設定
                if (Request["pageid"] != null)
                {
                    if (int.TryParse(Request["pageid"].ToString(), out ckint))
                    {
                        lb_page.Text = "?pageid=" + ckint.ToString();
                    }
                    else
                    {
                        lb_page.Text = "?pageid=0";
                    }
                }
                else
                    lb_page.Text = "?pageid=0";

                if (Request["adm_sid"] != null)
                    lb_page.Text += "&adm_sid=" + Server.UrlEncode(Request["adm_sid"]);

                if (Request["adm_title"] != null)
                    lb_page.Text += "&adm_title=" + Server.UrlEncode(Request["adm_title"]);

                if (Request["adm_fname"] != null)
                    lb_page.Text += "&adm_fname=" + Server.UrlEncode(Request["adm_fname"]);

                if (Request["adm_fmail"] != null)
                    lb_page.Text += "&adm_fmail=" + Server.UrlEncode(Request["adm_fmail"]);

                if (Request["btime"] != null)
                    lb_page.Text += "&btime=" + Server.UrlEncode(Request["btime"]);

                if (Request["etime"] != null)
                    lb_page.Text += "&etime=" + Server.UrlEncode(Request["etime"]);
                #endregion

                #region 接受下一頁返回時的舊查詢條件
                lb_page.Text += "&sid=" + lb_adm_sid.Text;

                if (Request["pageid1"] != null)
                {
                    if (int.TryParse(Request["pageid1"], out ckint))
                    {
                        if (ckint > gv_Ad_List.PageCount)
                            ckint = gv_Ad_List.PageCount;

                        gv_Ad_List.PageIndex = ckint;

                        lb_page.Text += "&pageid1=" + ckint.ToString();
                    }
                    else
                        lb_pageid1.Text = "0";
                }

                if (Request["adl_email"] != null)
                {
                    if (int.TryParse(Request["adl_email"], out ckint))
                    {
                        tb_adl_email.Text = ckint.ToString();
                        ods_Ad_List.SelectParameters["adl_email"].DefaultValue = ckint.ToString();
                    }
                }

                if (Request["adb_ibtime"] != null)
                {
                    if (DateTime.TryParse(Request["adb_ibtime"], out ckbtime))
                    {
                        tb_ibtime.Text = ckint.ToString();
                        ods_Ad_List.SelectParameters["btime"].DefaultValue = ckbtime.ToString();
                    }
                }

                if (Request["adb_ietime"] != null)
                {
                    if (DateTime.TryParse(Request["adb_ietime"], out cketime))
                    {
                        tb_ietime.Text = ckint.ToString();
                        ods_Ad_List.SelectParameters["etime"].DefaultValue = cketime.ToString();
                    }
                }
                #endregion

                ods_Ad_List.DataBind();
                gv_Ad_List.DataBind();

                #region 檢查頁數是否超過
                if (gv_Ad_List.PageCount < gv_Ad_List.PageIndex + 1)
                {
                    gv_Ad_List.PageIndex = gv_Ad_List.PageCount;
                    gv_Ad_List.DataBind();
                }

                lb_pageid1.Text = gv_Ad_List.PageIndex.ToString();
                #endregion
            }
        }

        if (mErr != "")
            ClientScript.RegisterStartupScript(this.GetType(), "ClientScript", "alert(\"" + mErr + "\");location.replace(\"9001.aspx\");", true);
    }
    // 產生對應的 Sql Where 字串
    private string GetSqlString(string mg_sid, string mg_name, string mg_nike, string btime, string etime)
    {
        Common_Func cfc = new Common_Func();
        string subSql = "", tmpstr = "";
        int ckint = 0;
        DateTime cktime;

        if (int.TryParse(mg_sid, out ckint))
            subSql += " And mg_sid = " + ckint.ToString();

        // 檢查 mg_name 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(mg_name);
        if (tmpstr != "")
            subSql += " And mg_name Like '%" + tmpstr + "%'";

        // 檢查 mg_nike 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(mg_nike);
        if (tmpstr != "")
            subSql += " And mg_nike Like '%" + tmpstr + "%'";

        // 檢查開始時間是否有值
        if (DateTime.TryParse(btime, out cktime))
            subSql += " And last_date >= '" + cktime.ToString("yyyy/MM/dd HH:mm:ss") + "'";

        // 檢查結束時間是否有值
        if (DateTime.TryParse(etime, out cktime))
            subSql += " And last_date <= '" + cktime.ToString("yyyy/MM/dd HH:mm:ss") + "'";

        if (subSql != "")
            subSql = " Where" + subSql.Substring(4);

        return subSql;
    }
    // 產生對應的 Sql Where 字串
    private string GetSqlString(string fi_no1, string fi_name1, string visible1, string fi_no2, string fi_name2, string visible2)
    {
        Common_Func cfc = new Common_Func();
        string subSql = "", tmpstr = "";
        int ckint = 0;

        // 檢查 fi_no1 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(fi_no1);
        if (tmpstr != "")
            subSql += " And f2.fi_no1 = '" + tmpstr + "'";

        // 檢查 fi_name1 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(fi_name1);
        if (tmpstr != "")
            subSql += " And f1.fi_name1 Like '%" + tmpstr + "%'";

        // 檢查 visible1 是否有值
        if (int.TryParse(visible1, out ckint))
            if (ckint == 0 || ckint == 1)
                subSql += " And f1.is_visible = " + ckint.ToString();
            else
                subSql += " And f1.is_visible <> 2";
        else
            subSql += " And f1.is_visible <> 2";

        // 檢查 fi_no2 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(fi_no2);
        if (tmpstr != "")
            subSql += " And f2.fi_no2 = '" + tmpstr + "'";

        // 檢查 fi_name2 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(fi_name2);
        if (tmpstr != "")
            subSql += " And f2.fi_name2 Like '%" + tmpstr + "%'";

        // 檢查 visible2 是否有值
        if (int.TryParse(visible2, out ckint))
            if (ckint == 0 || ckint == 1)
                subSql += " And f2.is_visible = " + ckint.ToString();
            else
                subSql += " And f2.is_visible <> 2";
        else
            subSql += " And f1.is_visible <> 2";

        if (subSql != "")
            subSql = " Where" + subSql.Substring(4);

        return subSql;
    }
Ejemplo n.º 43
0
    // 檢查查詢條件是否改變
    private void Chk_Filter()
    {
        Common_Func cfc = new Common_Func();

        int ckint = 0;
        DateTime ckbtime, cketime;
        string tmpstr = "";

        // 有輸入編號,則設定條件
        if (int.TryParse(tb_mg_sid.Text.Trim(), out ckint))
            ods_Manager.SelectParameters["mg_sid"].DefaultValue = ckint.ToString();
        else
        {
            tb_mg_sid.Text = "";
            ods_Manager.SelectParameters["mg_sid"].DefaultValue = "";
        }

        // 有輸入姓名,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_mg_name.Text.Trim());
        if (tmpstr != "")
            ods_Manager.SelectParameters["mg_name"].DefaultValue = tmpstr;
        else
        {
            tb_mg_name.Text = "";
            ods_Manager.SelectParameters["mg_name"].DefaultValue = "";
        }

        // 有輸入暱稱,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_mg_nike.Text.Trim());
        if (tmpstr != "")
            ods_Manager.SelectParameters["mg_nike"].DefaultValue = tmpstr;
        else
        {
            tb_mg_nike.Text = "";
            ods_Manager.SelectParameters["mg_nike"].DefaultValue = "";
        }

        // 有輸入開始時間範圍,則設定條件
        if (DateTime.TryParse(tb_btime.Text.Trim(), out ckbtime))
            ods_Manager.SelectParameters["btime"].DefaultValue = ckbtime.ToString("yyyy/MM/dd HH:mm:ss");
        else
        {
            tb_btime.Text = "";
            ods_Manager.SelectParameters["btime"].DefaultValue = "";
        }

        // 有輸入結束時間範圍,則設定條件
        if (DateTime.TryParse(tb_etime.Text.Trim(), out cketime))
            ods_Manager.SelectParameters["etime"].DefaultValue = cketime.ToString("yyyy/MM/dd HH:mm:ss");
        else
        {
            tb_etime.Text = "";
            ods_Manager.SelectParameters["etime"].DefaultValue = "";
        }

        gv_Manager.DataBind();
        if (gv_Manager.PageCount -1 < gv_Manager.PageIndex)
        {
            gv_Manager.PageIndex = gv_Manager.PageCount;
            gv_Manager.DataBind();
        }

        lb_pageid.Text = gv_Manager.PageIndex.ToString();
    }
Ejemplo n.º 44
0
    // 顯示條件範圍設定
    protected void Btn_Set_Click(object sender, EventArgs e)
    {
        Common_Func cfc = new Common_Func();

        string tmpstr = "";
        int ckint = -1;

        // 有輸入 mg_sid,則設定條件
        if (int.TryParse(tb_mg_sid.Text.Trim(), out ckint))
        {
            tb_mg_sid.Text = ckint.ToString();
            ods_Func_Power.SelectParameters["mg_sid"].DefaultValue = ckint.ToString();
        }
        else
        {
            tb_mg_sid.Text = "";
            ods_Func_Power.SelectParameters["mg_sid"].DefaultValue = "";
        }

        // 有輸入 mg_id,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_mg_id.Text.Trim());
        if (tmpstr != "")
        {
            tb_mg_id.Text = tmpstr;
            ods_Func_Power.SelectParameters["mg_id"].DefaultValue = tmpstr;
        }
        else
        {
            tb_mg_id.Text = "";
            ods_Func_Power.SelectParameters["mg_id"].DefaultValue = "";
        }

        // 有輸入 mg_name,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_mg_name.Text.Trim());
        if (tmpstr != "")
        {
            tb_mg_name.Text = tmpstr;
            ods_Func_Power.SelectParameters["mg_name"].DefaultValue = tmpstr;
        }
        else
        {
            tb_mg_name.Text = "";
            ods_Func_Power.SelectParameters["mg_name"].DefaultValue = "";
        }

        // 有輸入 mg_nike,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_mg_nike.Text.Trim());
        if (tmpstr != "")
        {
            tb_mg_nike.Text = tmpstr;
            ods_Func_Power.SelectParameters["mg_nike"].DefaultValue = tmpstr;
        }
        else
        {
            tb_mg_nike.Text = "";
            ods_Func_Power.SelectParameters["mg_nike"].DefaultValue = "";
        }

        // 檢查權限
        if (rb_open.Checked)
            ods_Func_Power.SelectParameters["is_enable"].DefaultValue = "1";
        else if (rb_close.Checked)
            ods_Func_Power.SelectParameters["is_enable"].DefaultValue = "0";
        else
        {
            ods_Func_Power.SelectParameters["is_enable"].DefaultValue = "-1";
            rb_all.Checked = true;
        }

        gv_Func_Power.DataBind();
        if (gv_Func_Power.PageCount - 1 < gv_Func_Power.PageIndex)
        {
            gv_Func_Power.PageIndex = gv_Func_Power.PageCount;
            gv_Func_Power.DataBind();
        }
    }
    // 產生對應的 Sql Where 字串
    private string GetSqlString(string dt_name, string dt_caption, string dt_area)
    {
        StringBuilder sbstring = new StringBuilder();
        Common_Func cfc = new Common_Func();
        string subSql = "", tmpstr = "";

        // 檢查 dt_name 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(dt_name);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@dt_name+'%」 的方式
            subSql += " And dt_name Like '%'+@dt_name+'%'";
            sbstring.Append("@dt_name");
        }

        // 檢查 dt_caption 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(dt_caption);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@dt_caption+'%」 的方式
            subSql += " And dt_caption Like '%'+@dt_caption+'%'";
            sbstring.Append("@dt_caption");
        }

        // 檢查 dt_area 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(dt_area);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@dt_area+'%」 的方式
            subSql += " And dt_area Like '%'+@dt_area+'%'";
            sbstring.Append("@dt_area");
        }

        ParaString = sbstring.ToString();

        return subSql;
    }
Ejemplo n.º 46
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int ckint = 0;
            Common_Func cfc = new Common_Func();
            DateTime ckbtime, cketime;

            // 檢查使用者權限並存入使用紀錄。
            //Check_Power("1005", true);

            #region 接受下一頁返回時的舊查詢條件
            if (Request["pageid"] != null)
            {
                if (int.TryParse(Request["pageid"], out ckint))
                    gv_Manager.PageIndex = ckint;
                else
                    lb_pageid.Text = "0";
            }

            if (Request["mg_sid"] != null)
            {
                if (int.TryParse(Request["mg_sid"], out ckint))
                {
                    tb_mg_sid.Text = ckint.ToString();
                    ods_Manager.SelectParameters["mg_sid"].DefaultValue = ckint.ToString();
                }
            }

            if (Request["mg_name"] != null)
            {
                tb_mg_name.Text = cfc.CleanSQL(Request["mg_name"]);
                ods_Manager.SelectParameters["mg_name"].DefaultValue = tb_mg_name.Text;
            }

            if (Request["mg_nike"] != null)
            {
                tb_mg_nike.Text = cfc.CleanSQL(Request["mg_nike"]);
                ods_Manager.SelectParameters["mg_nike"].DefaultValue = tb_mg_nike.Text;
            }

            if (Request["btime"] != null)
                if (DateTime.TryParse(Request["btime"], out ckbtime))
                {
                    tb_btime.Text = Request["btime"];
                    ods_Manager.SelectParameters["btime"].DefaultValue = ckbtime.ToString("yyyy/MM/dd HH:mm:ss");
                }

            if (Request["etime"] != null)
                if (DateTime.TryParse(Request["etime"], out cketime))
                {
                    tb_btime.Text = Request["etime"];
                    ods_Manager.SelectParameters["etime"].DefaultValue = cketime.ToString("yyyy/MM/dd HH:mm:ss");
                }
            #endregion
        }

        #region 檢查頁數是否超過
        ods_Manager.DataBind();
        gv_Manager.DataBind();
        if (gv_Manager.PageCount < gv_Manager.PageIndex)
        {
            gv_Manager.PageIndex = gv_Manager.PageCount;
            gv_Manager.DataBind();
        }

        lb_pageid.Text = gv_Manager.PageIndex.ToString();
        #endregion
    }
Ejemplo n.º 47
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int ckint = 0;

        if (!IsPostBack)
        {
            Common_Func cfc = new Common_Func();
            DateTime ckbtime, cketime;

            // 檢查使用者權限並存入登入紀錄
            //Check_Power("9001", true);

            #region 接受下一頁返回時的舊查詢條件
            if (Request["pageid1"] != null)
            {
                if (int.TryParse(Request["pageid1"], out ckint))
                {
                    if (ckint > gv_Ad_Member.PageCount)
                        ckint = gv_Ad_Member.PageCount;

                    gv_Ad_Member.PageIndex = ckint;
                }
                else
                    lb_pageid1.Text = "0";
            }

            if (Request["adb_sid"] != null)
            {
                if (int.TryParse(Request["adb_sid"], out ckint))
                {
                    tb_adb_sid.Text = ckint.ToString();
                    ods_Ad_Member.SelectParameters["adb_sid"].DefaultValue = ckint.ToString();
                }
            }

            if (Request["adb_email"] != null)
            {
                if (int.TryParse(Request["adb_email"], out ckint))
                {
                    tb_adb_email.Text = ckint.ToString();
                    ods_Ad_Member.SelectParameters["adb_email"].DefaultValue = ckint.ToString();
                }
            }

            if (Request["adb_ibtime"] != null)
            {
                if (DateTime.TryParse(Request["adb_ibtime"], out ckbtime))
                {
                    tb_ibtime.Text = ckint.ToString();
                    ods_Ad_Member.SelectParameters["btime"].DefaultValue = ckbtime.ToString();
                }
            }

            if (Request["adb_ietime"] != null)
            {
                if (DateTime.TryParse(Request["adb_ietime"], out cketime))
                {
                    tb_ietime.Text = ckint.ToString();
                    ods_Ad_Member.SelectParameters["etime"].DefaultValue = cketime.ToString();
                }
            }
            #endregion

            #region 承接上一頁的查詢條件設定
            if (Request["pageid"] != null)
            {
                if (int.TryParse(Request["pageid"].ToString(), out ckint))
                {
                    lb_page.Text = "?pageid=" + ckint.ToString();
                }
                else
                {
                    lb_page.Text = "?pageid=0";
                }
            }

            if (Request["adm_sid"] != null)
                lb_page.Text += "&adm_sid=" + Server.UrlEncode(Request["adm_sid"]);

            if (Request["adm_title"] != null)
                lb_page.Text += "&adm_title=" + Server.UrlEncode(Request["adm_title"]);

            if (Request["adm_fname"] != null)
                lb_page.Text += "&adm_fname=" + Server.UrlEncode(Request["adm_fname"]);

            if (Request["adm_fmail"] != null)
                lb_page.Text += "&adm_fmail=" + Server.UrlEncode(Request["adm_fmail"]);

            if (Request["btime"] != null)
                lb_page.Text += "&btime=" + Server.UrlEncode(Request["btime"]);

            if (Request["etime"] != null)
                lb_page.Text += "&etime=" + Server.UrlEncode(Request["etime"]);
            #endregion

            ods_Ad_Member.DataBind();
            gv_Ad_Member.DataBind();

            #region 檢查頁數是否超過
            if (gv_Ad_Member.PageCount < gv_Ad_Member.PageIndex + 1)
            {
                gv_Ad_Member.PageIndex = gv_Ad_Member.PageCount - 1;
                gv_Ad_Member.DataBind();
            }

            lb_pageid1.Text = gv_Ad_Member.PageIndex.ToString();
            #endregion
        }
    }
Ejemplo n.º 48
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int ckint = 0;
            Common_Func cfc = new Common_Func();
            DateTime ckbtime, cketime;

            // 檢查使用者權限並存入登入紀錄
            //Check_Power("D001", true);

            ods_Fm_Forum.SelectParameters["is_close"].DefaultValue = "1";

            #region 接受下一頁返回時的舊查詢條件
            if (Request["pageid"] != null)
            {
                if (int.TryParse(Request["pageid"], out ckint))
                    gv_Fm_Forum.PageIndex = ckint;
                else
                    lb_pageid.Text = "0";
            }

            if (Request["ff_topic"] != null)
            {
                tb_ff_topic.Text = cfc.CleanSQL(Request["ff_topic"]);
                ods_Fm_Forum.SelectParameters["ff_topic"].DefaultValue = tb_ff_topic.Text;
            }

            if (Request["ff_desc"] != null)
            {
                tb_ff_desc.Text = cfc.CleanSQL(Request["ff_desc"]);
                ods_Fm_Forum.SelectParameters["ff_desc"].DefaultValue = tb_ff_desc.Text;
            }

            if (Request["ff_name"] != null)
            {
                tb_ff_name.Text = cfc.CleanSQL(Request["ff_name"]);
                ods_Fm_Forum.SelectParameters["ff_name"].DefaultValue = tb_ff_name.Text;
            }

            if (Request["btime"] != null)
            {
                if (DateTime.TryParse(Request["btime"], out ckbtime))
                {
                    tb_btime.Text = Request["btime"];
                    ods_Fm_Forum.SelectParameters["btime"].DefaultValue = ckbtime.ToString("yyyy/MM/dd HH:mm:ss");
                }
            }

            if (Request["etime"] != null)
            {
                if (DateTime.TryParse(Request["etime"], out cketime))
                {
                    tb_btime.Text = Request["etime"];
                    ods_Fm_Forum.SelectParameters["etime"].DefaultValue = cketime.ToString("yyyy/MM/dd HH:mm:ss");
                }
            }
            #endregion
        }

        #region 檢查頁數是否超過
        ods_Fm_Forum.DataBind();
        gv_Fm_Forum.DataBind();
        if (gv_Fm_Forum.PageCount < gv_Fm_Forum.PageIndex)
        {
            gv_Fm_Forum.PageIndex = gv_Fm_Forum.PageCount;
            gv_Fm_Forum.DataBind();
        }

        lb_pageid.Text = gv_Fm_Forum.PageIndex.ToString();
        #endregion
    }
    // 產生對應的 Sql Where 字串
    private string GetSqlString(string adm_sid, string adl_sid, string adl_email, string adl_send, string btime, string etime)
    {
        StringBuilder sbstring = new StringBuilder();
        Common_Func cfc = new Common_Func();
        string subSql = "", tmpstr = "";
        int ckint = 0;
        DateTime cktime;

        // 檢查 adm_sid 是否有值
        if (int.TryParse(adm_sid, out ckint))
        {
            subSql += " And adm_sid = " + ckint.ToString();
        }

        // 檢查 adl_sid 是否有值
        if (int.TryParse(adl_sid, out ckint))
        {
            subSql += " And adl_sid = " + ckint.ToString();
        }

        // 檢查 adl_send 是否有值
        if (int.TryParse(adl_send, out ckint))
        {
            subSql += " And adl_send= " + ckint.ToString();
        }

        // 檢查 adl_email 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(adl_email);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@adl_email+'%」 的方式
            subSql += " And adl_email Like '%'+@adl_email+'%'";
            sbstring.Append("@adl_email");
        }

        // 檢查 send_time 開始範圍是否有值
        if (DateTime.TryParse(btime, out cktime))
            subSql += " And send_time >= '" + cktime.ToString("yyyy/MM/dd HH:mm:ss") + "'";

        // 檢查 send_time 結束範圍是否有值
        if (DateTime.TryParse(etime, out cktime))
            subSql += " And send_time <= '" + cktime.ToString("yyyy/MM/dd HH:mm:ss") + "'";

        if (subSql != "")
            subSql = " Where" + subSql.Substring(4);

        ParaString = sbstring.ToString();

        return subSql;
    }
Ejemplo n.º 50
0
    // 檢查查詢條件是否改變
    private void Chk_Filter()
    {
        Common_Func cfc = new Common_Func();

        string tmpstr = "";

        // 有輸入 fc_name,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_fc_name.Text.Trim());
        if (tmpstr != "")
        {
            tb_fc_name.Text = tmpstr;
            ods_Fi_Content.SelectParameters["fc_name"].DefaultValue = tmpstr;
        }
        else
        {
            tb_fc_name.Text = "";
            ods_Fi_Content.SelectParameters["fc_name"].DefaultValue = "";
        }

        // 有輸入 fc_exy,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_fc_ext.Text.Trim());
        if (tmpstr != "")
        {
            tb_fc_ext.Text = tmpstr;
            ods_Fi_Content.SelectParameters["fc_ext"].DefaultValue = tmpstr;
        }
        else
        {
            tb_fc_ext.Text = "";
            ods_Fi_Content.SelectParameters["fc_ext"].DefaultValue = "";
        }

        // 有輸入 fc_desc,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_fc_desc.Text.Trim());
        if (tmpstr != "")
        {
            tb_fc_desc.Text = tmpstr;
            ods_Fi_Content.SelectParameters["fc_desc"].DefaultValue = tmpstr;
        }
        else
        {
            tb_fc_desc.Text = "";
            ods_Fi_Content.SelectParameters["fc_desc"].DefaultValue = "";
        }

        gv_Fi_Content.DataBind();
        if (gv_Fi_Content.PageCount - 1 < gv_Fi_Content.PageIndex)
        {
            gv_Fi_Content.PageIndex = gv_Fi_Content.PageCount;
            gv_Fi_Content.DataBind();
        }
    }
Ejemplo n.º 51
0
    protected void lb_ok_Click(object sender, EventArgs e)
    {
        string mErr = "";
        int mg_sid = -1;

        // 載入字串函數
        String_Func sfc = new String_Func();

        // 載入公用函數
        Common_Func cfc = new Common_Func();

        if (tb_mg_id.Text.Trim() == "")
            mErr += "「登入帳號」沒有輸入!\\n";
        else
            if (cfc.CheckSQL(tb_mg_id.Text.Trim()))
                mErr += "「登入帳號」請勿使用特殊符號!\\n";

        if (tb_mg_pass.Text.Trim() == "")
            mErr += "「登入密碼」沒有輸入!\\n";
        else
            if (cfc.CheckSQL(tb_mg_pass.Text.Trim()))
                mErr += "「登入密碼」請勿使用特殊符號!\\n";
            else if (tb_mg_pass.Text.Trim().Length > 12 || tb_mg_pass.Text.Trim().Length < 4)
                mErr += "「登入密碼」長度為4~12個字!!\\n";

        if (tb_mg_pass.Text != tb_mg_pass1.Text)
            mErr += "「登入密碼」與「密碼確認」不相同!\\n";

        if (tb_mg_name.Text.Trim() == "")
            mErr += "「姓名」沒有輸入!\\n";

        if (tb_mg_nike.Text.Trim() == "")
            mErr += "「暱稱」沒有輸入!\\n";

        if (tb_mg_unit.Text.Trim() == "")
            mErr += "「單位」沒有輸入!\\n";

        if (mErr == "")
        {
            using (SqlConnection Sql_conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["AppSysConnectionString"].ConnectionString))
            {
                string SqlString = "";
                Decoder decoder = new Decoder();

                // 建立 SQL 的語法
                SqlString = "Insert Into Manager (mg_name, mg_nike, mg_id, mg_pass, mg_unit, mg_desc)";
                SqlString += " Values (@mg_name, @mg_nike, @mg_id, @mg_pass, @mg_unit, @mg_desc);";
                SqlString += "Select @mg_sid = Scope_Identity()";

                using (SqlCommand Sql_Command = new SqlCommand())
                {
                    Sql_Command.Connection = Sql_conn;
                    Sql_Command.CommandText = SqlString;

                    // 擷取字串到資料庫所規範的大小 sfc.Left(string mdata, int leng)
                    Sql_Command.Parameters.AddWithValue("@mg_name", sfc.Left(tb_mg_name.Text, 12));
                    Sql_Command.Parameters.AddWithValue("@mg_nike", sfc.Left(tb_mg_nike.Text, 12));
                    Sql_Command.Parameters.AddWithValue("@mg_id", sfc.Left(tb_mg_id.Text, 12));
                    Sql_Command.Parameters.AddWithValue("@mg_pass", decoder.EnCode(sfc.Left(tb_mg_pass.Text, 12)));
                    Sql_Command.Parameters.AddWithValue("@mg_unit", sfc.Left(tb_mg_unit.Text, 50));
                    Sql_Command.Parameters.AddWithValue("@mg_desc", sfc.Left(tb_mg_desc.Text, 1000));

                    SqlParameter spt_mg_sid = Sql_Command.Parameters.Add("@mg_sid", SqlDbType.Int);
                    spt_mg_sid.Direction = ParameterDirection.Output;

                    Sql_conn.Open();

                    Sql_Command.ExecuteNonQuery();

                    // 取得新增資料的主鍵值
                    mg_sid = (int)spt_mg_sid.Value;
                }
            }
        }

        if (mErr == "")
        {
            mErr = "alert('存檔完成!\\n請繼續設定該員的權限.....\\n');location.replace('10051.aspx" + lb_page.Text + "&sid=" + mg_sid.ToString() + "');";
        }
        else
            mErr = "alert('" + mErr + "')";

        lt_show.Text = "<script language=javascript>" + mErr + "</script>";
    }
Ejemplo n.º 52
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string mErr = "";

        if (!IsPostBack)
        {
            int tp_sid = -1, ckint = -1;
            string tmpstr = "";
            Common_Func cfc = new Common_Func();

            // 檢查使用者權限但不存入登入紀錄
            //Check_Power("B001", false);

            if (Request["sid"] != null)
            {
                if (int.TryParse(Request["sid"], out tp_sid))
                {
                    lb_tp_sid.Text = tp_sid.ToString();
                    ods_Ts_User.SelectParameters["tp_sid"].DefaultValue = tp_sid.ToString();

                    // 取得資料
                    if (!GetData())
                        mErr = "找不到相關資料!\\n";

                    #region 接收下一頁傳來的參數
                    if (Request["pageid1"] != null)
                    {
                        if (int.TryParse(Request["pageid1"], out ckint))
                        {
                            if (ckint > gv_Ts_User.PageCount)
                                ckint = gv_Ts_User.PageCount;

                            gv_Ts_User.PageIndex = ckint;
                        }
                        else
                            lb_pageid1.Text = "0";
                    }

                    if (Request["tu_name"] != null)
                    {
                        tmpstr = cfc.CleanSQL(Request["tu_name"].Trim());
                        if (tmpstr != "")
                        {
                            tb_tu_name.Text = tmpstr;
                            ods_Ts_User.SelectParameters["tu_name"].DefaultValue = tmpstr;
                        }
                        else
                        {
                            tb_tu_name.Text = "";
                            ods_Ts_User.SelectParameters["tu_name"].DefaultValue = "";
                        }
                    }

                    if (Request["tu_no"] != null)
                    {
                        tmpstr = cfc.CleanSQL(Request["tu_no"].Trim());
                        if (tmpstr != "")
                        {
                            tb_tu_no.Text = tmpstr;
                            ods_Ts_User.SelectParameters["tu_no"].DefaultValue = tmpstr;
                        }
                        else
                        {
                            tb_tu_no.Text = "";
                            ods_Ts_User.SelectParameters["tu_no"].DefaultValue = "";
                        }
                    }

                    if (Request["tu_ip"] != null)
                    {
                        tmpstr = cfc.CleanSQL(Request["tu_ip"].Trim());
                        if (tmpstr != "")
                        {
                            tb_tu_ip.Text = tmpstr;
                            ods_Ts_User.SelectParameters["tu_ip"].DefaultValue = tmpstr;
                        }
                        else
                        {
                            tb_tu_ip.Text = "";
                            ods_Ts_User.SelectParameters["tu_ip"].DefaultValue = "";
                        }
                    }

                    #endregion

                    #region 接收上一頁傳來的參數
                    if (Request["pageid"] != null)
                        lb_page.Text = "?pageid=" + Request["pageid"].Trim();
                    else
                        lb_page.Text = "?pageid=0";

                    if (Request["tp_sid"] != null)
                        lb_page.Text += "&tp_sid=" + Request["tp_sid"].Trim();

                    if (Request["tp_title"] != null)
                        lb_page.Text += "&tp_title=" + Server.UrlEncode(Request["tp_title"].Trim());

                    if (Request["is_show"] != null)
                        lb_page.Text += "&is_show=" + Request["is_show"].Trim();

                    if (Request["b_time"] != null)
                        lb_page.Text += "&btime=" + Server.UrlEncode(Request["btime"].Trim());

                    if (Request["b_time"] != null)
                        lb_page.Text += "&etime=" + Server.UrlEncode(Request["etime"].Trim());
                    #endregion
                }
                else
                    mErr = "參數格式錯誤!\\n";
            }
            else
                mErr = "參數傳入錯誤!\\n";
        }

        if (mErr == "")
        {
            #region 檢查頁數是否超過
            ods_Ts_User.DataBind();
            gv_Ts_User.DataBind();
            if (gv_Ts_User.PageCount < gv_Ts_User.PageIndex)
            {
                gv_Ts_User.PageIndex = gv_Ts_User.PageCount;
                gv_Ts_User.DataBind();
            }

            lb_pageid1.Text = gv_Ts_User.PageIndex.ToString();
            #endregion
        }
        else
            ClientScript.RegisterStartupScript(this.GetType(), "ClientScript", "alert(\"" + mErr + "\");location.replace(\"B001.aspx" + lb_page.Text + "\");", true);
    }
Ejemplo n.º 53
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string mErr = "";

        if (!IsPostBack)
        {
            int ds_sid = -1, dt_sid = -1;
            Common_Func cfc = new Common_Func();

            // 檢查使用者權限不存入登入紀錄
            //Check_Power("G001", false);

            if (Request["dt_sid"] != null && Request["ds_sid"] != null)
            {
                if (int.TryParse(Request["dt_sid"], out dt_sid) && int.TryParse(Request["ds_sid"], out ds_sid))
                {
                    lb_ds_sid.Text = ds_sid.ToString();
                    lb_dt_sid.Text = dt_sid.ToString();

                    ods_Db_Record.SelectParameters["ds_sid"].DefaultValue = ds_sid.ToString();
                    ods_Db_Record.SelectParameters["dt_sid"].DefaultValue = dt_sid.ToString();

                    if (GetData())
                    {
                        #region 接受上一頁查詢條件
                        lb_page.Text = "?ds_sid=" + ds_sid.ToString();
                        if (Request["pageid"] == null)
                            lb_page.Text += "&pageid=0";
                        else
                            lb_page.Text += "&pageid=" + Request["pageid"];

                        if (Request["ds_code"] != null)
                            lb_page.Text += "&ds_code=" + Server.UrlEncode(Request["ds_code"]);

                        if (Request["ds_name"] != null)
                            lb_page.Text += "&ds_name=" + Server.UrlEncode(Request["ds_name"]);

                        if (Request["ds_database"] != null)
                            lb_page.Text += "&ds_database=" + Server.UrlEncode(Request["ds_database"]);

                        if (Request["sort"] != null)
                            lb_page.Text += "&sort=" + Server.UrlEncode(Request["sort"]);

                        if (Request["pageid1"] != null)
                        {
                            lb_page.Text += "&pageid1=" + Request["pageid1"];
                        }

                        if (Request["dt_name"] != null)
                        {
                            lb_page.Text += "&dt_name=" + Server.UrlEncode(Request["dt_name"]);
                        }

                        if (Request["dt_caption"] != null)
                        {
                            lb_page.Text += "&dt_caption=" + Server.UrlEncode(Request["dt_caption"]);
                        }

                        if (Request["dt_area"] != null)
                        {
                            lb_page.Text += "&dt_area=" + Server.UrlEncode(Request["dt_area"]);
                        }

                        if (Request["sort1"] != null)
                        {
                            lb_page.Text += "&sort1=" + Server.UrlEncode(Request["sort1"]);
                        }
                        #endregion
                    }
                }
                else
                    mErr = "參數格式錯誤!\\n";
            }
            else
                mErr = "參數傳送錯誤!\\n";
        }

        if (mErr == "")
        {
            #region 檢查頁數是否超過
            ods_Db_Record.DataBind();
            gv_Db_Record.DataBind();
            if (gv_Db_Record.PageCount < gv_Db_Record.PageIndex)
            {
                gv_Db_Record.PageIndex = gv_Db_Record.PageCount;
                gv_Db_Record.DataBind();
            }

            lb_pageid2.Text = gv_Db_Record.PageIndex.ToString();
            #endregion
        }
        else
            ClientScript.RegisterStartupScript(this.GetType(), "ClientScript", "alert(\"" + mErr + "\");history.go(-1);", true);
    }
Ejemplo n.º 54
0
    // 檢查查詢條件是否改變
    private void Chk_Filter()
    {
        Common_Func cfc = new Common_Func();

        string tmpstr = "";

        // 有輸入 tu_name,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_tu_name.Text.Trim());
        if (tmpstr != "")
            ods_Ts_User.SelectParameters["tu_name"].DefaultValue = tmpstr;
        else
        {
            tb_tu_name.Text = "";
            ods_Ts_User.SelectParameters["tu_name"].DefaultValue = "";
        }

        // 有輸入 tu_no,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_tu_no.Text.Trim());
        if (tmpstr != "")
            ods_Ts_User.SelectParameters["tu_no"].DefaultValue = tmpstr;
        else
        {
            tb_tu_no.Text = "";
            ods_Ts_User.SelectParameters["tu_no"].DefaultValue = "";
        }

        // 有輸入 tu_ip,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_tu_ip.Text.Trim());
        if (tmpstr != "")
            ods_Ts_User.SelectParameters["tu_ip"].DefaultValue = tmpstr;
        else
        {
            tb_tu_ip.Text = "";
            ods_Ts_User.SelectParameters["tu_ip"].DefaultValue = "";
        }

        gv_Ts_User.DataBind();
        if (gv_Ts_User.PageCount - 1 < gv_Ts_User.PageIndex)
        {
            gv_Ts_User.PageIndex = gv_Ts_User.PageCount;
            gv_Ts_User.DataBind();
        }
    }
Ejemplo n.º 55
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int ckint = 0;
        Common_Func cfc = new Common_Func();
        DateTime ckbtime, cketime;

        if (!IsPostBack)
        {
            // 檢查使用者權限並存入登入紀錄
            //Check_Power("A002", true);

            #region 接受下一頁返回時的舊查詢條件
            if (Request["pageid"] != null)
            {
                if (int.TryParse(Request["pageid"], out ckint))
                {
                    if (ckint > gv_Bt_Head.PageCount)
                        ckint = gv_Bt_Head.PageCount;

                    gv_Bt_Head.PageIndex = ckint;
                }
                else
                    lb_pageid.Text = "0";
            }

            if (Request["bh_sid"] != null)
            {
                if (int.TryParse(Request["bh_sid"], out ckint))
                {
                    tb_bh_sid.Text = ckint.ToString();
                    ods_Bt_Head.SelectParameters["bh_sid"].DefaultValue = ckint.ToString();
                }
            }

            if (Request["is_check"] != null)
            {
                if (Request["is_check"] == "0")
                {
                    rb_is_check0.Checked = true;
                    rb_is_check1.Checked = false;
                    rb_is_check_all.Checked = false;
                }
                else if (Request["is_check"] == "1")
                {
                    rb_is_check0.Checked = false;
                    rb_is_check1.Checked = true;
                    rb_is_check_all.Checked = false;
                }
                else
                {
                    rb_is_check0.Checked = false;
                    rb_is_check1.Checked = false;
                    rb_is_check_all.Checked = true;
                }
            }
            else
            {
                rb_is_check0.Checked = false;
                rb_is_check1.Checked = false;
                rb_is_check_all.Checked = true;
            }

            if (Request["btime"] != null)
            {
                if (DateTime.TryParse(Request["btime"], out ckbtime))
                {
                    tb_btime.Text = Request["btime"];
                    ods_Bt_Head.SelectParameters["btime"].DefaultValue = ckbtime.ToString("yyyy/MM/dd HH:mm:ss");
                }
            }

            if (Request["etime"] != null)
            {
                if (DateTime.TryParse(Request["etime"], out cketime))
                {
                    tb_btime.Text = Request["etime"];
                    ods_Bt_Head.SelectParameters["etime"].DefaultValue = cketime.ToString("yyyy/MM/dd HH:mm:ss");
                }
            }
            #endregion
        }

        #region 檢查頁數是否超過
        ods_Bt_Head.DataBind();
        gv_Bt_Head.DataBind();
        if (gv_Bt_Head.PageCount < gv_Bt_Head.PageIndex)
        {
            gv_Bt_Head.PageIndex = gv_Bt_Head.PageCount;
            gv_Bt_Head.DataBind();
        }

        lb_pageid.Text = gv_Bt_Head.PageIndex.ToString();
        #endregion
    }
    // 產生對應的 Sql Where 字串
    private string GetSqlString(string fc_name, string fc_ext, string fc_desc)
    {
        Common_Func cfc = new Common_Func();
        string subSql = "", tmpstr = "";

        // 檢查 fc_name 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(fc_name);
        if (tmpstr != "")
            subSql += " And c.fc_name Like '%" + tmpstr + "%'";

        // 檢查 fc_ext 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(fc_ext);
        if (tmpstr != "")
            subSql += " And c.fc_ext Like '%" + tmpstr + "%'";

        // 檢查 fc_desc 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(fc_desc);
        if (tmpstr != "")
            subSql += " And c.fc_desc Like '%" + tmpstr + "%'";

        return subSql;
    }
Ejemplo n.º 57
0
    // 檢查查詢條件是否改變
    private void Chk_Filter()
    {
        Common_Func cfc = new Common_Func();

        int ckint = 0;
        string tmpstr = "";

        // 有輸入編號,則設定條件
        if (int.TryParse(tb_tp_sid.Text.Trim(), out ckint))
            ods_Ts_Paper.SelectParameters["tp_sid"].DefaultValue = ckint.ToString();
        else
        {
            tb_tp_sid.Text = "";
            ods_Ts_Paper.SelectParameters["tp_sid"].DefaultValue = "";
        }

        // 有輸入 tp_title,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_tp_title.Text.Trim());
        if (tmpstr != "")
            ods_Ts_Paper.SelectParameters["tp_title"].DefaultValue = tmpstr;
        else
        {
            tb_tp_title.Text = "";
            ods_Ts_Paper.SelectParameters["tp_title"].DefaultValue = "";
        }

        gv_Ts_Paper.DataBind();
        if (gv_Ts_Paper.PageCount - 1 < gv_Ts_Paper.PageIndex)
        {
            gv_Ts_Paper.PageIndex = gv_Ts_Paper.PageCount;
            gv_Ts_Paper.DataBind();
        }
    }
    // 產生對應的 Sql Where 字串
    private string GetSqlString(string mg_sid, string mg_id, string mg_name, string mg_nike)
    {
        Common_Func cfc = new Common_Func();
        string subSql = "", tmpstr = "";
        int ckint = 0;

        // 檢查 mg_sid 是否有值
        if (int.TryParse(mg_sid, out ckint))
            subSql += " And m.mg_sid = " + ckint.ToString();

        // 檢查 mg_id 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(mg_id);
        if (tmpstr != "")
            subSql += " And m.mg_id Like '%" + tmpstr + "%'";

        // 檢查 mg_name 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(mg_name);
        if (tmpstr != "")
            subSql += " And m.mg_name Like '%" + tmpstr + "%'";

        // 檢查 mg_nike 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(mg_nike);
        if (tmpstr != "")
            subSql += " And m.mg_nike Like '%" + tmpstr + "%'";

        return subSql;
    }
Ejemplo n.º 59
0
    // 產生對應的 Sql Where 字串
    private string GetSqlString(string ds_sid, string ds_code, string ds_name, string ds_database)
    {
        StringBuilder sbstring = new StringBuilder();
        Common_Func cfc = new Common_Func();
        string subSql = "", tmpstr = "";
        int ckint = 0;

        // 檢查 ds_sid 是否有值
        if (int.TryParse(ds_sid, out ckint))
        {
            subSql += " And ds_sid = " + ckint.ToString();
        }

        // 檢查 ds_code 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(ds_code);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@ds_code+'%」 的方式
            subSql += " And ds_code Like '%'+@ds_code+'%'";
            sbstring.Append("@ds_code");
        }

        // 檢查 ds_name 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(ds_name);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@ds_name+'%」 的方式
            subSql += " And ds_name Like '%'+@ds_name+'%'";
            sbstring.Append("@ds_name");
        }

        // 檢查 ds_database 是否有值,並清除 SQL 隱碼攻擊的字元
        tmpstr = cfc.CleanSQL(ds_database);
        if (tmpstr != "")
        {
            // 使用 like 時 要用 「%'+@ds_database+'%」 的方式
            subSql += " And ds_database Like '%'+@ds_database+'%'";
            sbstring.Append("@ds_database");
        }

        if (subSql != "")
            subSql = " Where" + subSql.Substring(4);

        ParaString = sbstring.ToString();

        return subSql;
    }
Ejemplo n.º 60
0
    // 檢查查詢條件是否改變
    private void Chk_Filter()
    {
        Common_Func cfc = new Common_Func();

        int ckint = 0;
        DateTime ckbtime, cketime;
        string tmpstr = "";

        // 有輸入編號,則設定條件
        if (int.TryParse(tb_adb_sid.Text.Trim(), out ckint))
            ods_Ad_Member.SelectParameters["adb_sid"].DefaultValue = ckint.ToString();
        else
        {
            tb_adb_sid.Text = "";
            ods_Ad_Member.SelectParameters["adb_sid"].DefaultValue = "";
        }

        // 有輸入 adb_name,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_adb_name.Text.Trim());
        if (tmpstr != "")
            ods_Ad_Member.SelectParameters["adb_name"].DefaultValue = tmpstr;
        else
        {
            tb_adb_name.Text = "";
            ods_Ad_Member.SelectParameters["adb_name"].DefaultValue = "";
        }

        // 有輸入 adb_email,則設定條件 (cfc.CleanSQL() => 移除可能為 SQL 隱碼攻擊的字串)
        tmpstr = cfc.CleanSQL(tb_adb_email.Text.Trim());
        if (tmpstr != "")
            ods_Ad_Member.SelectParameters["adb_email"].DefaultValue = tmpstr;
        else
        {
            tb_adb_email.Text = "";
            ods_Ad_Member.SelectParameters["adb_email"].DefaultValue = "";
        }

        // 有輸入異動時間開始範圍,則設定條件
        if (DateTime.TryParse(tb_ibtime.Text.Trim(), out ckbtime))
            ods_Ad_Member.SelectParameters["btime"].DefaultValue = ckbtime.ToString("yyyy/MM/dd HH:mm:ss");
        else
        {
            tb_ibtime.Text = "";
            ods_Ad_Member.SelectParameters["btime"].DefaultValue = "";
        }

        // 有輸入異動時間結束範圍,則設定條件
        if (DateTime.TryParse(tb_ietime.Text.Trim(), out cketime))
            ods_Ad_Member.SelectParameters["etime"].DefaultValue = cketime.ToString("yyyy/MM/dd HH:mm:ss");
        else
        {
            tb_ietime.Text = "";
            ods_Ad_Member.SelectParameters["etime"].DefaultValue = "";
        }

        gv_Ad_Member.DataBind();
        if (gv_Ad_Member.PageCount - 1 < gv_Ad_Member.PageIndex)
        {
            gv_Ad_Member.PageIndex = gv_Ad_Member.PageCount;
            gv_Ad_Member.DataBind();
            lb_pageid1.Text = gv_Ad_Member.PageIndex.ToString();
        }
    }