コード例 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (gvClients.IsNewRowEditing)
            {
                Master.ShowMessage(Diary.Common.Constant.Message_ClientNeedToUpdate);
                return;
            }

            caseEntity.Code = txtCode.Text.Trim();
            caseEntity.Case = txtCase.Text.Trim();
            caseEntity.CaseTypeId = new Guid(cmbCaseType.Value.ToString());
            caseEntity.OffenceTypeId = new Guid(cmbOffence.Value.ToString());
            caseEntity.CourtId = new Guid(cmbCourt.Value.ToString());
            caseEntity.Email = txtEmail.Text.Trim();
            caseEntity.Contact = txtContact.Text.Trim();

            caseEntity.CreatedBy = Master.LoggedUser.UserId.Value;
            caseEntity.UpdatedBy = Master.LoggedUser.UserId.Value;

            caseEntity.Clients = (DataSet)Session["ClientData"];

            bll.Case caseBll = new bll.Case();

            if (hdnCaseId.Value == string.Empty)
            {
                if (!caseBll.IsCaseExists(caseEntity.Code))
                {
                    caseBll.InsertCase(caseEntity);
                    Master.ShowMessage(Diary.Common.Constant.Message_Success);
                    this.ClearFormFields();
                    Session["ClientData"] =null;

                }
                else
                {
                    Master.ShowMessage(Diary.Common.Constant.Message_AlreadyExists);
                }
            }
            else
            {
                caseEntity.CaseId = new Guid(hdnCaseId.Value);
                caseBll.UpdateCase(caseEntity);
                Master.ShowMessage(Diary.Common.Constant.Message_Success);
                this.ClearFormFields();
            }
        }
コード例 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (gvClients.IsNewRowEditing)
            {
                Master.ShowMessage(Diary.Common.Constant.Message_ClientNeedToUpdate);
                return;
            }

            caseEntity.Code          = txtCode.Text.Trim();
            caseEntity.Case          = txtCase.Text.Trim();
            caseEntity.CaseTypeId    = new Guid(cmbCaseType.Value.ToString());
            caseEntity.OffenceTypeId = new Guid(cmbOffence.Value.ToString());
            caseEntity.CourtId       = new Guid(cmbCourt.Value.ToString());
            caseEntity.Email         = txtEmail.Text.Trim();
            caseEntity.Contact       = txtContact.Text.Trim();

            caseEntity.CreatedBy = Master.LoggedUser.UserId.Value;
            caseEntity.UpdatedBy = Master.LoggedUser.UserId.Value;

            caseEntity.Clients = (DataSet)Session["ClientData"];

            bll.Case caseBll = new bll.Case();

            if (hdnCaseId.Value == string.Empty)
            {
                if (!caseBll.IsCaseExists(caseEntity.Code))
                {
                    caseBll.InsertCase(caseEntity);
                    Master.ShowMessage(Diary.Common.Constant.Message_Success);
                    this.ClearFormFields();
                    Session["ClientData"] = null;
                }
                else
                {
                    Master.ShowMessage(Diary.Common.Constant.Message_AlreadyExists);
                }
            }
            else
            {
                caseEntity.CaseId = new Guid(hdnCaseId.Value);
                caseBll.UpdateCase(caseEntity);
                Master.ShowMessage(Diary.Common.Constant.Message_Success);
                this.ClearFormFields();
            }
        }