Пример #1
0
        public DataTable M_Authorizations_AccessCheck(M_Authorizations_Entity mae)
        {
            Dictionary <string, ValuePair> dic = new Dictionary <string, ValuePair>
            {
                { "@ProgramID", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = mae.ProgramID
                  } },
                { "@StaffCD", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = mae.StaffCD
                  } },
                { "@PC", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = mae.PC
                  } }
            };

            return(SelectData(dic, "M_Authorizations_AccessCheck"));
        }
Пример #2
0
        /// <summary>
        /// Access Check
        /// </summary>
        /// <param name="mae">Staff And Program Relation Check</param>
        /// <returns>if no access to open then return null else return all info</returns>
        public M_AuthorizationsDetails_Entity M_Authorizations_AccessCheck(M_Authorizations_Entity mae)
        {
            M_Authorizations_DL madl            = new M_Authorizations_DL();
            DataTable           dtAuthorization = madl.M_Authorizations_AccessCheck(mae);

            if (dtAuthorization.Rows.Count > 0)
            {
                string messageID = dtAuthorization.Rows[0]["MessageID"].ToString();
                if (messageID.Equals("allow"))
                {
                    M_AuthorizationsDetails_Entity made = new M_AuthorizationsDetails_Entity
                    {
                        Insertable                    = dtAuthorization.Rows[0]["Insertable"].ToString(),
                        Updatable                     = dtAuthorization.Rows[0]["Updatable"].ToString(),
                        Deletable                     = dtAuthorization.Rows[0]["Deletable"].ToString(),
                        Inquirable                    = dtAuthorization.Rows[0]["Inquirable"].ToString(),
                        Printable                     = dtAuthorization.Rows[0]["Printable"].ToString(),
                        Outputable                    = dtAuthorization.Rows[0]["Outputable"].ToString(),
                        Runable                       = dtAuthorization.Rows[0]["Runable"].ToString(),
                        StoreAuthorizationsCD         = dtAuthorization.Rows[0]["StoreAuthorizationsCD"].ToString(),
                        StoreAuthorization_ChangeDate = dtAuthorization.Rows[0]["ChangeDate"].ToString(),

                        //KTP 2019-05-29 select ProgramName and Type
                        ProgramID   = dtAuthorization.Rows[0]["ProgramID"].ToString(),
                        ProgramName = dtAuthorization.Rows[0]["ProgramName"].ToString(),
                        ProgramType = dtAuthorization.Rows[0]["Type"].ToString()
                    };
                    return(made);
                }
                else
                {
                    mae.MessageID = messageID;
                    return(null);
                }
            }
            return(null);
        }
        /// <summary>
        /// 起動時共通処理
        ///
        /// check Authorization
        /// insert to log(form open)
        /// </summary>
        /// <remarks>プログラム起動時に呼び出してください</remarks>
        protected void StartProgram()
        {
            //共通処理 受取パラメータ、接続情報
            //コマンドライン引数より情報取得
            //Iniファイルより情報取得
            //this.GetCmdLine() == false ||

            if (this.GetCmdLine() == false || loginbl.ReadConfig() == false)
            {
                //起動時エラー    DB接続不可能
                this.Close();
                System.Environment.Exit(0);
            }


            //共通処理 Operator 確認
            //[M_Staff]
            M_Staff_Entity mse = new M_Staff_Entity
            {
                StaffCD = InOperatorCD
            };

            mse = loginbl.M_Staff_InitSelect(mse);

            // MessageBox.Show(bbl.GetConnectionString());

            this.lblOperatorName.Text = mse.StaffName;
            //this.lblLoginDate.Text = mse.SysDate;
            DataTable dtShopName = bbl.SimpleSelect1("42", null, "222", "1");

            this.lblShopName.Text = dtShopName.Rows[0]["Char1"].ToString();

            M_Store_Entity mste = new M_Store_Entity
            {
                SysDate = mse.SysDate
            };

            mste = loginbl.M_Store_InitSelect(mse, mste);
            this.lblStoreName.Text = mste.StoreName;
            StoreCD    = mste.StoreCD;
            ChangeDate = mste.SysDate;

            //共通処理 プログラム
            //KTP - 2019-05-29 ProgramのチェックはM_Authorizations_AccessCheck にやっています。
            //[M_Program]
            //mpe = new M_Program_Entity
            //{
            //    ProgramID = InProgramID,
            //    Type = "1"  //仮
            //};

            //bool ret = loginbl.M_Program_InitSelect(mpe);
            //if (ret == false)
            //{
            //    //S012
            //    bbl.ShowMessage("S012");
            //    //起動時エラー
            //    this.Close();
            //    System.Environment.Exit(0);
            //}

            //Authorizations判断
            M_Authorizations_Entity mae;

            mae = new M_Authorizations_Entity
            {
                ProgramID = this.InProgramID,
                StaffCD   = InOperatorCD,
                PC        = InPcID
            };

            made = bbl.M_Authorizations_AccessCheck(mae);

            if (made == null)
            {
                bbl.ShowMessage(mae.MessageID);
                //起動時エラー
                this.Close();
                System.Environment.Exit(0);
            }

            //KTP 2019-05-29 Set ProgrameName, ProgramID
            this.Text = made.ProgramID;
            //lblHeaderTitle.Text = made.ProgramName;

            //KTP 2019-05-29 M_Authorizations_AccessCheckにやっています。 line no 513 to 521
            //Program type判断
            //switch (mpe.Type)
            //{
            //    case "1":

            //        if (made.Insertable == "0" && made.Updatable == "0" && made.Deletable == "0" && made.Inquirable == "0")
            //        {
            //            //S003
            //            bbl.ShowMessage("S003");
            //            //起動時エラー
            //            this.Close();
            //            System.Environment.Exit(0);
            //        }
            //        break;

            //    case "2":
            //        if (made.Printable == "0")
            //        {
            //            //S003
            //            bbl.ShowMessage("S003");
            //            //起動時エラー
            //            this.Close();
            //            System.Environment.Exit(0);
            //        }
            //        break;

            //    case "3":
            //        if (made.Printable == "0" && made.Outputable == "0")
            //        {
            //            //S003
            //            bbl.ShowMessage("S003");
            //            //起動時エラー
            //            this.Close();
            //            System.Environment.Exit(0);
            //        }
            //        break;

            //    case "4":
            //        if (made.Outputable == "0")
            //        {
            //            //S003
            //            bbl.ShowMessage("S003");
            //            //起動時エラー
            //            this.Close();
            //            System.Environment.Exit(0);
            //        }
            //        break;

            //    case "5":
            //        if (made.Inquirable == "0")
            //        {
            //            //S003
            //            bbl.ShowMessage("S003");
            //            //起動時エラー
            //            this.Close();
            //            System.Environment.Exit(0);
            //        }
            //        break;

            //    case "6":
            //        if (made.Runable == "0")
            //        {
            //            //S003
            //            bbl.ShowMessage("S003");
            //            //起動時エラー
            //            this.Close();
            //            System.Environment.Exit(0);
            //        }
            //        break;
            //}

            //処理可能店舗
            //[M_StoreAuthorizations]
            M_StoreAuthorizations_Entity msa = new M_StoreAuthorizations_Entity();

            msa.StoreAuthorizationsCD = made.StoreAuthorizationsCD;

            DataTable dt = bbl.M_StoreAuthorizations_Select(msa);

            if (dt.Rows.Count > 0)
            {
                availableStores = new string[dt.Rows.Count];
                int i = 0;
                foreach (DataRow row in dt.Rows)
                {
                    availableStores[i] = row["StoreCD"].ToString();
                    i++;
                }
            }
            ///Added by ETZ ,To close when StoreAuthorization isn't accessed
            else
            {
                bbl.ShowMessage(mae.MessageID);
                //起動時エラー
                this.Close();
                System.Environment.Exit(0);
            }

            //プログラム起動履歴
            //InsertLog(Get_L_Log_Entity(true));

            //KTP 2019-05-29 Program Type Select from M_Authorizations_AccessCheck function
            //Todo:入力プログラム以外を考慮
            //switch (mpe.Type)
            //switch (made.ProgramType)
            //{
            //    case "1":
            //        if (made.Insertable == "1")
            //        {
            //            // 新規ボタン押下処理
            //            FunctionProcess((int)EOperationMode.INSERT);
            //        }
            //        else if (made.Updatable == "1")
            //        {
            //            // 修正ボタン押下処理
            //            FunctionProcess((int)EOperationMode.UPDATE);
            //        }
            //        else if (made.Deletable == "1")
            //        {
            //            // 削除ボタン押下処理
            //            FunctionProcess((int)EOperationMode.DELETE);
            //        }
            //        else
            //        {
            //            // 照会ボタン押下処理
            //            FunctionProcess((int)EOperationMode.SHOW);
            //        }
            //        break;
            //}
        }