Пример #1
0
        protected void BtnInsert_Click(Object sender, System.EventArgs e)
        {
            ClAgreement cl = new ClAgreement();

            cl = Data;

            int t = 0;

            if (CSharp.PublicFunction.ModeInsert(AgreementID.ToString()))
            {
                t = AgreementClass.insert(cl);
            }
            else
            {
                t = AgreementClass.Update(cl);
            }

            if (t == 0)
            {
                LblMsg.ForeColor = System.Drawing.Color.Red;
                CSharp.Utility.ShowMsg(Page, CSharp.ProPertyData.MsgType.warning, "خطا در ثبت");
                //  LblMsg.Text = "";
            }
            else
            {
                LblMsg.ForeColor = System.Drawing.Color.Green;
                CSharp.Utility.ShowMsg(Page, CSharp.ProPertyData.MsgType.General_Success, "ثبت  انجام شد");
                LblMsg.Text = "ثبت  انجام شد.";
                BindGrid();
            }
            LightBox.Value           = "0";
            LblParamAgreementID.Text = "0";
        }
 protected override void WriteDataOnParent(MainForm frm, Control parent, ref Point location)
 {
     EventLabel(frm, parent, ref location, "Agreement ID:", AgreementID.ToString());
     EventLabel(frm, parent, ref location, "God", God);
     EventLabel(frm, parent, ref location, "HF:", HF);
     EventLabel(frm, parent, ref location, "Site:", Site);
     EventLabel(frm, parent, ref location, "Artifact:", Artifact);
     EventLabel(frm, parent, ref location, "Concluder HF:", ConcluderHF);
     EventLabel(frm, parent, ref location, "Agreement Subject ID:", AgreementSubjectID.ToString());
     EventLabel(frm, parent, ref location, "Reason:", Reason);
 }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    int slnId         = SlnID;
                    var agreementList = DbDataLoader.GetAgreement(slnId);
                    ddlAgreement.DataSource     = agreementList;
                    ddlAgreement.DataTextField  = "Title";
                    ddlAgreement.DataValueField = "AgreementID";
                    ddlAgreement.DataBind();

                    if (ddlAgreement.Items.Count == 0)
                    {
                        ddlAgreement.Items.Add(new ListItem("选择类别", "0"));
                    }


                    var versiontList = DbDataLoader.GetVersion(slnId);
                    versiontList.Insert(0, new VersionMode()
                    {
                        ID = 0, SlnID = slnId, Title = "选择版本"
                    });
                    ddVersion.DataSource     = versiontList;
                    ddVersion.DataTextField  = "Title";
                    ddVersion.DataValueField = "ID";
                    ddVersion.DataBind();

                    if (IsModify)
                    {
                        ContractModel model = DbDataLoader.GetContract(slnId, ContractID, 0);
                        if (model != null)
                        {
                            txtID.Text                 = model.ID.ToString();
                            txtDescption.Text          = model.Descption;
                            ddlAgreement.SelectedValue = model.AgreementID.ToString();
                            ddVersion.SelectedValue    = model.VerID.ToString();
                            btnDelete.Visible          = true;
                        }
                    }
                    else
                    {
                        ddlAgreement.SelectedValue = AgreementID.ToString();
                        btnDelete.Visible          = false;
                        ddVersion.SelectedValue    = VerID.ToString();
                    }
                }
                catch (Exception)
                {
                }
            }
        }
        protected void lvCRMAgreement_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 AgreementID;

            Int64.TryParse(e.CommandArgument.ToString(), out AgreementID);

            if (AgreementID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _AgreementID = AgreementID;

                    PrepareEditView();
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementEntity.FLD_NAME_AgreementID, AgreementID.ToString(), SQLMatchType.Equal);

                        CRMAgreementEntity cRMAgreementEntity = new CRMAgreementEntity();

                        result = FCCCRMAgreement.GetFacadeCreate().Delete(cRMAgreementEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _AgreementID        = 0;
                            _CRMAgreementEntity = new CRMAgreementEntity();
                            PrepareInitialView();
                            BindCRMAgreementList();

                            MiscUtil.ShowMessage(lblMessage, "Agreement has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Agreement.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        protected void lvCRMAgreement_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 AgreementID;

            Int64.TryParse(e.CommandArgument.ToString(), out AgreementID);

            if (AgreementID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _AgreementID = AgreementID;
                    //PrepareEditView();

                    String navUrl = UrlHelper.BuildSecureUrl("~/CRM/CRMAgreement.aspx", String.Empty, UrlConstants.OVERVIEW_AGREEMENT_ID, AgreementID.ToString()).ToString();
                    Response.Redirect(navUrl);
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        CRMAgreementEntity cRMAgreementEntity = FCCCRMAgreement.GetFacadeCreate().GetByID(AgreementID);

                        if (cRMAgreementEntity.AgreementApprovalStatusID == MasterDataConstants.CRMMDAgreementApprovalStatus.INITIATED)
                        {
                            Int64 result = -1;

                            String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementEntity.FLD_NAME_AgreementID, AgreementID.ToString(), SQLMatchType.Equal);

                            result = FCCCRMAgreement.GetFacadeCreate().Delete(cRMAgreementEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                            if (result == 0)
                            {
                                _AgreementID        = 0;
                                _CRMAgreementEntity = new CRMAgreementEntity();
                                PrepareInitialView();
                                BindCRMAgreementList();

                                MiscUtil.ShowMessage(lblMessage, "Agreement Successfully deleted.", true);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to delete Agreement.", true);
                            }
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Agreement Can't be deleted expect 'Initiated' Status.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }