Exemplo n.º 1
0
        /// <summary>
        /// フォルダ設定
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult AddFileTypeSet(FileTypeSet model)
        {
            int result = -1;

            if (Session["LoginId"] == null)
            {
                result = -99;
            }
            else
            {
                try
                {
                    //FileTypeSet model = JsonHelper.ParseFormJson<FileTypeSet>(jsonModel);
                    string dt = Common.CommonUtil.DateTimeNowToString();
                    IFileTypeSetService setService = BLLFactory.ServiceAccess.CreateFileTypeSetService();
                    if (model.monitorServerFolderName == null)
                    {
                        model.monitorServerFolderName = "";
                    }
                    if (model.systemFileFlg == null)
                    {
                        model.systemFileFlg = "0";
                    }
                    if (model.hiddenFileFlg == null)
                    {
                        model.hiddenFileFlg = "0";
                    }
                    if (model.exceptAttributeFlg1 == null)
                    {
                        model.exceptAttributeFlg1 = "0";
                    }
                    if (model.exceptAttributeFlg2 == null)
                    {
                        model.exceptAttributeFlg2 = "0";
                    }
                    if (model.exceptAttributeFlg3 == null)
                    {
                        model.exceptAttributeFlg3 = "0";
                    }
                    if (model.exceptAttribute1 == null)
                    {
                        model.exceptAttribute1 = "";
                    }
                    if (model.exceptAttribute2 == null)
                    {
                        model.exceptAttribute2 = "";
                    }
                    if (model.exceptAttribute3 == null)
                    {
                        model.exceptAttribute3 = "";
                    }
                    if (model.id == null || model.id == "")
                    {//インサート
                        model.createDate = dt;
                        model.updateDate = dt;
                        model.creater    = Session["LoginId"].ToString();
                        model.updater    = Session["LoginId"].ToString();
                        result           = setService.InsertFileTypeSet(model);
                    }
                    else
                    { //更新
                        model.updateDate = dt;
                        model.updater    = Session["LoginId"].ToString();
                        result           = setService.UpdateFileTypeSet(model);
                    }
                }
                catch (Exception ex)
                {
                    result = -10;
                    logger.Error(ex.Message);
                }
            }
            Response.Write(result);
            Response.End();
            return(null);
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            IFileTypeSetService IFileTypeSetService = BLLFactory.ServiceAccess.CreateFileTypeSetService();
            FileTypeSet         fileTypeSet         = new FileTypeSet();

            if (msFolderName != "")
            {
                fileTypeSet.monitorServerFolderName = msFolderName;
            }
            fileTypeSet.monitorServerID     = Convert.ToInt32(mServerID);
            fileTypeSet.exceptAttribute1    = "";
            fileTypeSet.exceptAttribute2    = "";
            fileTypeSet.exceptAttribute3    = "";
            fileTypeSet.exceptAttributeFlg1 = "0";
            fileTypeSet.exceptAttributeFlg2 = "0";
            fileTypeSet.exceptAttributeFlg3 = "0";
            fileTypeSet.systemFileFlg       = "0";
            fileTypeSet.hiddenFileFlg       = "0";
            if (this.chkExceptAttr1.Checked == true && this.txtExceptAttr1.Text.Trim() != "")
            {
                fileTypeSet.exceptAttributeFlg1 = "1";
            }
            if (this.txtExceptAttr1.Text.Trim() != "")
            {
                fileTypeSet.exceptAttribute1 = this.txtExceptAttr1.Text.Trim();
            }
            if (this.chkExceptAttr2.Checked == true && this.txtExceptAttr2.Text.Trim() != "")
            {
                fileTypeSet.exceptAttributeFlg2 = "1";
            }
            if (this.txtExceptAttr2.Text.Trim() != "")
            {
                fileTypeSet.exceptAttribute2 = this.txtExceptAttr2.Text.Trim();
            }
            if (this.chkExceptAttr3.Checked == true && this.txtExceptAttr3.Text.Trim() != "")
            {
                fileTypeSet.exceptAttributeFlg3 = "1";
            }
            if (this.txtExceptAttr3.Text.Trim() != "")
            {
                fileTypeSet.exceptAttribute3 = this.txtExceptAttr3.Text.Trim();
            }
            //if (this.chkSystemFileFlg.Checked == true)
            //{
            //    fileTypeSet.systemFileFlg = "1";
            //}
            //if (this.chkHiddenFileFlg.Checked == true)
            //{
            //    fileTypeSet.hiddenFileFlg = "1";
            //}
            fileTypeSet.deleteFlg  = 0;
            fileTypeSet.creater    = FrmMain.userinfo.loginID;
            fileTypeSet.createDate = CommonUtil.DateTimeNowToString();
            fileTypeSet.updater    = FrmMain.userinfo.loginID;
            fileTypeSet.updateDate = CommonUtil.DateTimeNowToString();

            FileTypeSet fts = IFileTypeSetService.GetFileTypeSetByMonitorServerIdAndFolderName(mServerID, msFolderName);

            if (fts.id != "" && fts.id != null)
            {
                fileTypeSet.id = fts.id;
                int updateFlg = -1;
                if (MsgHelper.QuestionMsg(ValidationRegex.Q002, ValidationRegex.publicTitle))
                {
                    try
                    {
                        updateFlg = IFileTypeSetService.UpdateFileTypeSet(fileTypeSet);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }
                if (updateFlg > -1)
                {
                    MsgHelper.InfoMsg(ValidationRegex.U001, ValidationRegex.publicTitle);
                    gFlag = true;
                    this.Dispose();
                }
                else
                {
                    MsgHelper.InfoMsg(ValidationRegex.U002, ValidationRegex.publicTitle);
                }
            }
            else
            {
                int insertFlg = -1;
                if (this.txtExceptAttr1.Text.Trim() != "" ||
                    this.txtExceptAttr2.Text.Trim() != "" ||
                    this.txtExceptAttr3.Text.Trim() != "" ||
                    this.chkHiddenFileFlg.Checked == true ||
                    this.chkSystemFileFlg.Checked == true)
                {
                    if (MsgHelper.QuestionMsg(ValidationRegex.Q002, ValidationRegex.publicTitle))
                    {
                        try
                        {
                            insertFlg = IFileTypeSetService.InsertFileTypeSet(fileTypeSet);
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                        }
                    }
                }
                if (this.txtExceptAttr1.Text.Trim() == "" &&
                    this.txtExceptAttr2.Text.Trim() == "" &&
                    this.txtExceptAttr3.Text.Trim() == "" ||
                    this.chkHiddenFileFlg.Checked == true ||
                    this.chkSystemFileFlg.Checked == true)
                {
                    insertFlg = 0;
                }
                if (insertFlg > -1)
                {
                    MsgHelper.InfoMsg(ValidationRegex.I001, ValidationRegex.publicTitle);
                    gFlag = true;
                    this.Dispose();
                }
                else
                {
                    MsgHelper.InfoMsg(ValidationRegex.I002, ValidationRegex.publicTitle);
                }
            }
            this.DialogResult = DialogResult.OK;
        }