Exemple #1
0
        //回傳值 false未通過驗證,還原輸入的值 true.未通過驗證,保留原值
        protected override bool WfItemCheck(object sender, ItemCheckInfo e)
        {
            try
            {
                #region 單頭-pick vw_puri020
                if (e.Row.Table.Prefix.ToLower() == "vw_puri020")
                {
                    switch (e.Column.ToLower())
                    {
                        #region pba01 廠商分類編號check
                    case "pba01":
                        if (BoPur.OfChkPbaPKExists(GlobalFn.isNullRet(e.Value, "")) == true)
                        {
                            WfShowErrorMsg("廠商分類編號已存在,請檢核!");
                            return(false);
                        }
                        break;
                        #endregion
                    }
                }
                #endregion

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        //回傳值 true.通過驗證 false.未通過驗證,
        protected override bool WfItemCheck(object sender, ItemCheckInfo e)
        {
            vw_puri030s        detailModel;
            List <vw_puri030s> detailList;
            int iChkCnts = 0;

            try
            {
                #region 單頭-pick vw_puri030
                if (e.Row.Table.Prefix.ToLower() == "vw_puri030")
                {
                    switch (e.Column.ToLower())
                    {
                    case "pba01":    //採購取價代號
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            return(true);
                        }
                        if (BoPur.OfChkPbaPKExists(GlobalFn.isNullRet(e.Value, "")) == true)
                        {
                            WfShowErrorMsg("採購取價代號已存在,請檢核!");
                            return(false);
                        }
                        break;
                    }
                }
                #endregion

                #region 單身-pick vw_puri030s
                if (e.Row.Table.Prefix.ToLower() == "vw_puri030s")
                {
                    detailModel = e.Row.ToItem <vw_puri030s>();
                    detailList  = e.Row.Table.ToList <vw_puri030s>();
                    switch (e.Column.ToLower())
                    {
                    case "pbc03":    //取價類型
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            return(true);
                        }
                        iChkCnts = detailList.Where(p => p.pbc02 != detailModel.pbc02)
                                   .Where(p => p.pbc03 == e.Value.ToString())
                                   .Count();
                        if (iChkCnts > 0)
                        {
                            WfShowErrorMsg("取價類型不得重覆!");
                            return(false);
                        }
                        break;

                    case "pbc04":    //取價順序
                        if (GlobalFn.varIsNull(e.Value) || GlobalFn.isNullRet(e.Value, 0) == 0)
                        {
                            return(true);
                        }
                        iChkCnts = detailList.Where(p => p.pbc02 != detailModel.pbc02)
                                   .Where(p => p.pbc04 == Convert.ToInt16(e.Value))
                                   .Count();
                        if (iChkCnts > 0)
                        {
                            WfShowErrorMsg("取價順序不得重覆!");
                            return(false);
                        }
                        break;
                    }
                }
                #endregion

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
        //回傳值 true.通過驗證 false.未通過驗證,會把值還原
        protected override bool WfItemCheck(object sender, ItemCheckInfo e)
        {
            List <vw_puri100s> detailList;
            vw_puri100s        detailModel;
            int iChkCnts = 0;

            try
            {
                #region 單頭-pick vw_puri100
                if (e.Row.Table.Prefix.ToLower() == "vw_puri100")
                {
                    switch (e.Column.ToLower())
                    {
                    case "pca01":    //廠商編號
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            return(true);
                        }
                        if (BoPur.OfChkPcaPKExists(e.Value.ToString()) == true)
                        {
                            WfShowErrorMsg("廠商編號已存存,請檢核!");
                            return(false);
                        }
                        break;

                    case "pca04":    //廠商分類
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            return(true);
                        }
                        if (BoPur.OfChkPbaPKExists(GlobalFn.isNullRet(e.Value, "")) == false)
                        {
                            WfShowErrorMsg("無此廠商分類,請檢核!");
                            return(false);
                        }
                        break;

                    case "pca05":    //負責採購
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            e.Row["pca05_c"] = "";
                            return(true);
                        }
                        if (BoBas.OfChkBecPKValid(GlobalFn.isNullRet(e.Value, "")) == false)
                        {
                            WfShowErrorMsg("無此負責採購,請檢核!");
                            return(false);
                        }
                        e.Row["pca05_c"] = BoBas.OfGetBec02(GlobalFn.isNullRet(e.Value, ""));
                        break;

                    case "pca21":    //付款方式
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            e.Row["pca21_c"] = "";
                            return(true);
                        }
                        if (BoBas.OfChkBefPKValid("1", GlobalFn.isNullRet(e.Value, "")) == false)
                        {
                            WfShowErrorMsg("無此付款方式,請檢核!");
                            return(false);
                        }
                        e.Row["pca21_c"] = BoBas.OfGetBef03("1", GlobalFn.isNullRet(e.Value, ""));
                        break;

                    case "pca24":    //取價原則
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            e.Row["pca24_c"] = "";
                            return(true);
                        }
                        if (BoPur.OfChkPbbPKExists(GlobalFn.isNullRet(e.Value, "")) == false)
                        {
                            WfShowErrorMsg("無此取價原則,請檢核!");
                            return(false);
                        }
                        e.Row["pca24_c"] = BoPur.OfGetPbb02(GlobalFn.isNullRet(e.Value, ""));
                        break;

                    case "pca26":    //金融機構
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            return(true);
                        }
                        if (BoBas.OfChkBegPKExists(GlobalFn.isNullRet(e.Value, "")) == false)
                        {
                            WfShowErrorMsg("無此金融機構,請檢核!");
                            return(false);
                        }
                        break;

                    case "pca35":    //送貨地址
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            return(true);
                        }
                        if (BoPur.OfChkPccPKValid(GlobalFn.isNullRet(e.Value, ""), "1") == false)
                        {
                            WfShowErrorMsg("無此送貨地址,請檢核!");
                            return(false);
                        }
                        break;

                    case "pca36":    //帳單地址
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            return(true);
                        }
                        if (BoPur.OfChkPccPKValid(GlobalFn.isNullRet(e.Value, ""), "2") == false)
                        {
                            WfShowErrorMsg("無此帳單地址,請檢核!");
                            return(false);
                        }
                        break;
                    }
                }
                #endregion

                #region 單身-pick vw_puri100
                if (e.Row.Table.Prefix.ToLower() == "vw_puri100s")
                {
                    detailModel = e.Row.ToItem <vw_puri100s>();
                    detailList  = e.Row.Table.ToList <vw_puri100s>();
                    switch (e.Column.ToLower())
                    {
                    case "pcb02":
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            return(true);
                        }
                        iChkCnts = detailList.Where(x => x.pcb02 == detailModel.pcb02).Count();
                        if (iChkCnts > 1)
                        {
                            WfShowErrorMsg("地址碼已存在!");
                            return(false);
                        }
                        break;
                    }
                }
                #endregion
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }