Ejemplo n.º 1
0
    private void InitModule(FineOffice.Modules.OA_Contract model)
    {
        hiddenWrite.Text             = "modify";
        btnUpload.Enabled            = true;
        btnDeleteAttachment.Enabled  = true;
        btnTransfer.Enabled          = true;
        btnDownAttachment.Enabled    = true;
        btnModifyAttachment.Enabled  = true;
        btnRefreshAttachment.Enabled = true;

        hiddenID.Text        = model.ID.ToString();
        txtContent.Text      = model.Content;
        txtContractName.Text = model.ContractName;
        txtContractNO.Text   = model.ContractNO;
        dtpEndDate.Text      = string.Format("{0:yyyy-MM-dd}", model.EndDate);
        dtpSingnDate.Text    = string.Format("{0:yyyy-MM-dd}", model.SingnDate);
        if (model.Handler != null)
        {
            hiddenHandler.Text = model.Handler.ToString();
            txtHandler.Text    = model.HandlerName;
        }
        txtLocation.Text = model.Location;
        txtRemark.Text   = model.Remark;
        if (model.TraderID != null)
        {
            hiddenTraderID.Text = model.TraderID.ToString();
            txtTrader.Text      = model.TraderName;
        }
        ddlType.SelectedValue = model.TypeID.ToString();
        attachmentGrid_Bind();
    }
Ejemplo n.º 2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.CookiePersonnel == null)
        {
            Alert.ShowInParent("当前用户不存在职员信息!");
            return;
        }
        FineOffice.Modules.OA_Contract model = new FineOffice.Modules.OA_Contract();
        bool modify = false;

        if (hiddenWrite.Text.Equals("modify"))
        {
            int id = int.Parse(hiddenID.Text);
            model  = contractBll.GetModel(t => t.ID == id);
            modify = true;
        }
        model.Content      = txtContent.Text.Trim();
        model.ContractName = txtContractName.Text.Trim();
        model.ContractNO   = txtContractNO.Text.Trim();
        model.EndDate      = DateTime.Parse(dtpEndDate.Text);
        model.SingnDate    = DateTime.Parse(dtpSingnDate.Text);
        if (hiddenHandler.Text.Length > 0)
        {
            model.Handler = int.Parse(hiddenHandler.Text);
        }
        model.Location = txtLocation.Text;
        model.Remark   = txtRemark.Text;
        if (hiddenTraderID.Text.Length > 0)
        {
            model.TraderID = int.Parse(hiddenTraderID.Text);
        }
        model.TypeID = int.Parse(ddlType.SelectedValue);
        try
        {
            if (modify)
            {
                model = contractBll.Update(model);
            }
            else
            {
                model = contractBll.Add(model);
            }
            InitModule(model);
        }
        catch (Exception ex)
        {
            Alert.ShowInParent(ex.Message);
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
            txtTrader.OnClientTriggerClick = traderWin.GetSaveStateReference(txtTrader.ClientID, hiddenTraderID.ClientID)
                                             + traderWin.GetShowReference("../common/FrmRadioTrader.aspx");

            txtHandler.OnClientTriggerClick = handlerWin.GetSaveStateReference(txtHandler.ClientID, hiddenHandler.ClientID)
                                              + handlerWin.GetShowReference("../common/FrmRadioPersonnel.aspx");

            btnModifyAttachment.OnClientClick = attachmentGrid.GetNoSelectionAlertReference(string.Format("请选择要操作的{0}!", attachmentGrid.Title));
            btnDownAttachment.OnClientClick   = attachmentGrid.GetNoSelectionAlertReference(string.Format("请选择要下载的{0}!", attachmentGrid.Title));
            btnDeleteAttachment.ConfirmText   = string.Format("你确认要删除选中{0}吗!", attachmentGrid.Title);
            btnDeleteAttachment.ConfirmTarget = Target.Parent;

            btnUpload.Enabled            = false;
            btnDeleteAttachment.Enabled  = false;
            btnTransfer.Enabled          = false;
            btnDownAttachment.Enabled    = false;
            btnModifyAttachment.Enabled  = false;
            btnRefreshAttachment.Enabled = false;

            if (Request["Write"] == null)
            {
                hiddenWrite.Text = "new";
            }
            else
            {
                int id = int.Parse(Request["ID"]);
                hiddenTabID.Text = this._FrmWriteContract.ID + id;
                FineOffice.Modules.OA_Contract model = contractBll.GetModel(t => t.ID == id);
                InitModule(model);
            }
            btnClose.OnClientClick = string.Format("parent.closeTabWindow('{0}');", this.hiddenTabID.Text);
        }
        if (Request.Form["__EVENTARGUMENT"] == "refresh_attachment")
        {
            btnRefreshAttachment_Click(null, null);
        }
    }
Ejemplo n.º 4
0
 protected void btnReset_Click(object sender, EventArgs e)
 {
     if (hiddenWrite.Text.Equals("modify"))
     {
         int id = int.Parse(hiddenID.Text);
         FineOffice.Modules.OA_Contract model = contractBll.GetModel(t => t.ID == id);
         InitModule(model);
     }
     else
     {
         txtContent.Text       = "";
         txtContractName.Text  = "";
         txtContractNO.Text    = "";
         dtpEndDate.Text       = "";
         dtpSingnDate.Text     = "";
         hiddenHandler.Text    = "";
         txtHandler.Text       = "";
         txtLocation.Text      = "";
         txtRemark.Text        = "";
         hiddenTraderID.Text   = "";
         txtTrader.Text        = "";
         ddlType.SelectedIndex = 0;
     }
 }