コード例 #1
0
        public async Task <IActionResult> AddorEdit([Bind("TaxId,TaxName,Code,Rate,Description,Status,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP")] taxmaster taxmaster)
        {
            if (ModelState.IsValid)
            {
                if (taxmaster.TaxId == 0)
                {
                    taxmaster.Status     = AppConstant.Active;
                    taxmaster.CreatedOn  = System.DateTime.Now;
                    taxmaster.ModifiedOn = System.DateTime.Now;
                    taxmaster.IP         = GETIP.GetIp();

                    taxmaster.CompanyID = AppConstant.CompanyID;
                    context.Add(taxmaster);
                }
                else
                {
                    taxmaster.Status     = AppConstant.Active;
                    taxmaster.ModifiedOn = System.DateTime.Now;
                    taxmaster.IP         = GETIP.GetIp();
                    taxmaster.CompanyID  = AppConstant.CompanyID;
                    context.Update(taxmaster);
                }
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(taxmaster));
        }
コード例 #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     taxmaster tax = new taxmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
     tax.taxmaster_SRNO = -1;
     tax.taxmaster_TAXNAME = txttaxname.Text;
     tax.taxmaster_TAXVALUE = Convert.ToDouble(txttaxvalue.Text);
     tax.taxmaster_TAXUNIT = ddlunit.SelectedValue.ToString();
     tax.taxmaster_STATUS = 0;
     if (tax.Insert(true, "taxmaster"))
     {
         MessageBox("Tax Entry Added Successfully");
         gettaxdetails();
         
     }
 }
コード例 #3
0
 protected void btnedit_Click(object sender, EventArgs e)
 {
     taxmaster tax = new taxmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
     tax.taxmaster_SRNO = -1;
     tax.taxmaster_TAXNAME = txteditname.Text.Trim().ToString();
     tax.taxmaster_TAXVALUE = Convert.ToDouble(txteditvalue.Text.Trim().ToString());
     tax.taxmaster_TAXUNIT = ddleditunit.SelectedValue.ToString();
     tax.taxmaster_STATUS = General.Parse<int>(ddlstatus.SelectedValue.ToString()); 
     string condition = "SRNO=" + ViewState["tax"].ToString();
     if (tax.Insert(false, "taxmaster", condition))
     {
         MessageBox("Tax Entry Updated Successfully");
         gettaxdetails();
     }
     ScriptManager.RegisterStartupScript(this, this.GetType(), "Edit", "FillState();", true);
 }