예제 #1
0
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        byte SysMessageTypeId = 0;
        int  SysMessageId     = 0;

        System.Int16 EditId;
        Warranty     m_Warranty = new Warranty();

        if (Request.QueryString["id"] == null)
        {
            EditId = 0;
        }
        else
        {
            EditId = System.Int16.Parse(Request.QueryString["id"].ToString());
            m_Warranty.WarrantyId = EditId;
            m_Warranty            = m_Warranty.Get();
        }
        try
        {
            if (txWarrantyName.Text == "")
            {
                JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this);
                return;
            }


            m_Warranty.CrUserId = ActUserId;

            if (txWarrantyName.Text != "")
            {
                m_Warranty.WarrantyName = txWarrantyName.Text;
            }

            if (txWarrantyDesc.Text != "")
            {
                m_Warranty.WarrantyDesc = txWarrantyDesc.Text;
            }

            m_Warranty.DisplayOrder = short.Parse(txDisplayOrder.Text);

            m_Warranty.WarrantyId = EditId;
            SysMessageTypeId      = m_Warranty.InsertOrUpdate(ConstantHelpers.Replicated, ActUserId, ref SysMessageId);

            StringBuilder       csText = new StringBuilder();
            Type                cstype = this.GetType();
            ClientScriptManager cs     = Page.ClientScript;
            csText.Clear();
            csText.Append("<script type=\"text/javascript\">");
            csText.Append("window.parent.jQuery('#divEdit').dialog('close');");
            csText.Append("</script>");
            cs = Page.ClientScript;
            cs.RegisterClientScriptBlock(this.GetType(), "system_message", csText.ToString());
        }
        catch (Exception ex)
        {
            sms.utils.LogFiles.LogError(((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name + "\t" + ex.ToString());
            JSAlertHelpers.Alert(ex.Message, this);
        }
    }
예제 #2
0
        public ActionResult FinishDate(Warranty record)
        {
            var           result  = false;
            var           message = "Lưu thông tin không thành công";
            WarrantyModel model   = null;

            if (AccountInfo.Type != LoginType.Sale && AccountInfo.Username != "admin")
            {
                message = "Bạn chưa có quyền sử dụng chức năng này";
            }
            else if (result = record.SaveFinishDate(UserID, Employee.ID))
            {
                message = "Lưu thông tin thành công";
                model   = Warranty.Get(UserID, Employee.ID, record.ID);
                var login = Login.Get(UserID);
                model.ViewInternalNote = login.Type == LoginType.Mechanic || login.Type == LoginType.Office || login.Username == "admin";
            }
            if (Request.IsAjaxRequest())
            {
                return(Json(new
                {
                    result = result,
                    message = message,
                    html = result ? RenderPartialViewToString(Views.Detail, model) : null
                }, JsonRequestBehavior.DenyGet));
            }
            var list = new WarrantyList();

            list.Current = model;
            return(View(Views.History, list));
        }
예제 #3
0
 private void bindData()
 {
     System.Int16 EditId;
     if (Request.QueryString["id"] == null)
     {
         return;
     }
     else
     {
         EditId = System.Int16.Parse(Request.QueryString["id"].ToString());
         Warranty m_Warranty = new Warranty();
         m_Warranty.WarrantyId = EditId;
         m_Warranty            = m_Warranty.Get();
         txWarrantyName.Text   = m_Warranty.WarrantyName.ToString();
         txWarrantyDesc.Text   = m_Warranty.WarrantyDesc.ToString();
         txDisplayOrder.Text   = m_Warranty.DisplayOrder.ToString();
     }
 }