Ejemplo n.º 1
0
        protected void btnSaveConfirmed_Click(object sender, EventArgs e)
        {
            try
            {
                Product product = new Product();
                product.ItemID       = Convert.ToInt32(hdItemId.Value);
                product.Name         = txtItemName.Text.Trim();
                product.UnitID       = Convert.ToInt32(ddlUOM.SelectedValue);
                product.TaxId        = Convert.ToInt32(ddlTax.SelectedValue);
                product.Description  = txtDescription.Text.Trim();
                product.ItemCode     = txtItemCode.Text.Trim();
                product.OEMCode      = txtOEM.Text.Trim();
                product.HSCode       = txtHSCode.Text.Trim();
                product.Barcode      = txtBarcode.Text.Trim();
                product.TypeID       = Convert.ToInt32(ddlType.SelectedValue);
                product.MRP          = Convert.ToDecimal(txtMrp.Text);
                product.CostPrice    = Convert.ToDecimal(txtCost.Text);
                product.SellingPrice = Convert.ToDecimal(txtSell.Text);
                //product.Remarks = txtRemarks.Text.Trim();
                product.CategoryID = Convert.ToInt32(ddlCategory.SelectedValue);
                product.GroupID    = Convert.ToInt32(ddlGroup.SelectedValue);
                product.BrandID    = Convert.ToInt32(ddlBrand.SelectedValue);
                product.CompanyId  = CPublic.GetCompanyID();
                product.CreatedBy  = CPublic.GetuserID();
                product.ModifiedBy = CPublic.GetuserID();
                product.Status     = Convert.ToInt32(ddlStatus.SelectedValue);
                OutputMessage result = null;
                if (product.ItemID == 0)
                {
                    result = product.Save();

                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "')", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + result.Message + "')", true);
                    }
                }
                else
                {
                    result = product.Update();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "')", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + result.Message + "')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 2
0
        protected void btnSaveConfirmed_Click(object sender, EventArgs e)
        {
            try
            {
                Entities.Payroll.OfficeShift off = new Entities.Payroll.OfficeShift();
                off.ID               = Convert.ToInt32(hdId.Value);
                off.Name             = txtName.Text.Trim();
                off.MondayInTime     = Convert.ToDateTime(txtMonClockIn.Text);
                off.MondayOutTime    = Convert.ToDateTime(txtMonClockOut.Text);
                off.TuesdayInTime    = Convert.ToDateTime(txtTueClockIn.Text);
                off.TuesdayOutTime   = Convert.ToDateTime(txtTueClockOut.Text);
                off.WednesdayInTime  = Convert.ToDateTime(txtWedClockIn.Text);
                off.WednesdayOutTime = Convert.ToDateTime(txtWedClockOut.Text);
                off.ThursdayInTime   = Convert.ToDateTime(txtThuClockIn.Text);
                off.ThursdayOutTime  = Convert.ToDateTime(txtThuClockOut.Text);
                off.FridayInTime     = Convert.ToDateTime(txtFriClockIn.Text);
                off.FridayOutTime    = Convert.ToDateTime(txtFriClockOut.Text);
                off.SaturdayInTime   = Convert.ToDateTime(txtSatClockIn.Text);
                off.SaturdayOuttime  = Convert.ToDateTime(txtSatClockOut.Text);
                off.SundayInTime     = Convert.ToDateTime(txtSunClockIn.Text);
                off.SundayOutTime    = Convert.ToDateTime(txtSunClockOut.Text);
                off.CompanyId        = CPublic.GetCompanyID();
                off.CreatedBy        = CPublic.GetuserID();
                off.ModifiedBy       = CPublic.GetuserID();

                Entities.OutputMessage result = null;
                if (off.ID == 0)
                {
                    result = off.Save();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
                else
                {
                    result = off.Update();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + ex.Message + "')", true);
            }
        }
 protected void btnSaveConfirmed_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.Finance.AccountOpeningBalance OpeningBalance = new Entities.Finance.AccountOpeningBalance();
         OpeningBalance.AccountHeadID = Convert.ToInt32(ddlAccountHead.SelectedValue);
         OpeningBalance.ChildheadID   = Convert.ToInt32(ddlSubAccountHead.SelectedValue);
         OpeningBalance.Balance       = Convert.ToDecimal(txtOpeningBalance.Text);
         OpeningBalance.OpeningDate   = Convert.ToDateTime(txtOpeningDate.Text);
         OpeningBalance.CreatedBy     = CPublic.GetuserID();
         OpeningBalance.SQLtable      = hdSqlTable.Value;
         OpeningBalance.ModifiedBy    = CPublic.GetuserID();
         OpeningBalance.isDebit       = Convert.ToInt32(ddlISDebit.SelectedValue);
         OpeningBalance.ID            = Convert.ToInt32(hdItemId.Value);
         try
         {
             OutputMessage result = new OutputMessage();
             if (OpeningBalance.ID == 0)
             {
                 result = OpeningBalance.Save();
                 if (result.Success)
                 {
                     ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                     reset();
                 }
                 else
                 {
                     ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + result.Message + "')", true);
                 }
             }
             else
             {
                 result = OpeningBalance.Update();
                 if (result.Success)
                 {
                     ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                     reset();
                 }
                 else
                 {
                     ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + result.Message + "')", true);
                 }
             }
         }
         catch (Exception)
         {
         }
     }
     catch (Exception)
     {
     }
 }
Ejemplo n.º 4
0
 protected void btnSaveConfirmed_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.Location location = new Entities.Location();
         location.ID            = Convert.ToInt32(hdLocationId.Value);
         location.Name          = txtName.Text.Trim();
         location.Address1      = txtAddress1.Text.Trim();
         location.Address2      = txtAddress2.Text.Trim();
         location.Contact       = txtContact.Text.Trim();
         location.ContactPerson = txtContactPerson.Text.Trim();
         location.RegId1        = txtRegId1.Text.Trim();
         location.RegId2        = txtRegId2.Text.Trim();
         location.Status        = Convert.ToInt32(ddlStatus.SelectedValue);
         location.CompanyId     = CPublic.GetCompanyID();
         location.CreatedBy     = CPublic.GetuserID();
         location.ModifiedBy    = CPublic.GetuserID();
         OutputMessage result = null;
         if (location.ID == 0)
         {
             result = location.Save();
             if (result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
             }
         }
         else
         {
             result = location.Update();
             if (result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
             }
         }
     }
     catch (Exception ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + ex.Message + "')", true);
     }
 }
Ejemplo n.º 5
0
 protected void btnSaveConfirmed_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.Master.Despatch despatch = new Entities.Master.Despatch();
         despatch.ID                 = Convert.ToInt32(hdDespatchId.Value);
         despatch.Name               = txtName.Text.Trim();
         despatch.Address            = txtAddress.Text.Trim();
         despatch.PhoneNo            = txtPhone.Text.Trim();
         despatch.MobileNo           = txtMobile.Text.Trim();
         despatch.ContactPerson      = txtContactPerson.Text.Trim();
         despatch.ContactPersonPhone = txtContactPersonPhone.Text.Trim();
         despatch.Narration          = txtNarration.Text.Trim();
         despatch.Status             = Convert.ToInt32(ddlStatus.SelectedValue);
         despatch.CompanyId          = CPublic.GetCompanyID();
         despatch.CreatedBy          = CPublic.GetuserID();
         despatch.ModifiedBy         = CPublic.GetuserID();
         OutputMessage result = null;
         if (despatch.ID == 0)
         {
             result = despatch.Save();
             if (result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(GetType(), "message", "successAlert('" + result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
             }
         }
         else
         {
             result = despatch.Update();
             if (result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
             }
         }
     }
     catch (FormatException ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('Enter a Valid despatch')", true);
     }
 }
Ejemplo n.º 6
0
 protected void btnSaveConfirmed_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.Finance.AccountGroup Account = new Entities.Finance.AccountGroup();
         Account.Id          = Convert.ToInt32(hdItemId.Value);
         Account.Name        = txtAccountGroupName.Text;
         Account.Disable     = Convert.ToInt32(ddlStatus.SelectedValue);
         Account.Description = txtDescription.Text;
         Account.Depth       = 1;
         Account.ParentId    = Convert.ToInt32(ddlParentGroup.SelectedValue);
         Account.Company     = CPublic.GetCompanyID();
         Account.AccountType = Convert.ToInt32(ddlAccountNature.SelectedValue);
         Account.CreatedBy   = CPublic.GetuserID();
         Account.IsAffectGP  = Convert.ToInt32(ddlIsAffectGrossProfit.SelectedValue);
         Account.ModifiedBy  = CPublic.GetuserID();
         OutputMessage Result = null;
         if (Account.Id == 0)
         {
             Result = Account.Save();
             if (Result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');window.setTimeout(function(){window.location.href = '/Finance/AccountGroup';}, 3000); ", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
             }
         }
         else
         {
             Result = Account.Update();
             if (Result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');window.setTimeout(function(){window.location.href = '/Finance/AccountGroup';}, 3000);", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
             }
         }
     }
     catch (Exception)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('Enter a Valid Group')", true);
     }
 }
Ejemplo n.º 7
0
 protected void btnSaveConfirmed_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.Finance.VoucherType Voucher = new Entities.Finance.VoucherType();
         Voucher.ID               = Convert.ToInt32(hdItemId.Value);
         Voucher.IsDebit          = Convert.ToInt32(ddlIsDebit.SelectedValue);
         Voucher.Name             = txtVoucherTypeName.Text;
         Voucher.CreatedBy        = CPublic.GetuserID();
         Voucher.Disable          = Convert.ToInt32(ddlDisable.SelectedValue);
         Voucher.Numbering        = Convert.ToInt32(ddlNumbering.SelectedValue);
         Voucher.NumberStartFrom  = Convert.ToInt32(txtNumberingStarts.Text);
         Voucher.RestartNumber    = Convert.ToInt32(ddlRestartsOn.SelectedValue);
         Voucher.DisplayInJournal = Convert.ToInt32(ddlDisplayInJournal.SelectedValue);
         Voucher.ModifiedBy       = CPublic.GetuserID();
         OutputMessage Result = null;
         if (Voucher.ID == 0)
         {
             Result = Voucher.Save();
             if (Result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
             }
         }
         else
         {
             Result = Voucher.Update();
             if (Result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
             }
         }
     }
     catch (Exception ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('Something Went Wrong')", true);
     }
 }
Ejemplo n.º 8
0
        protected void btnSaveConfirmed_Click(object sender, EventArgs e)
        {
            try
            {
                Entities.Category Cat = new Entities.Category();
                Cat.ID         = Convert.ToInt32(hdItemId.Value);
                Cat.Name       = txtCategoryName.Text.Trim();
                Cat.Order      = Convert.ToInt32(txtCategoryOrder.Text);
                Cat.Status     = Convert.ToInt32(ddlCategoryStatus.SelectedValue);
                Cat.CompanyId  = CPublic.GetCompanyID();
                Cat.CreatedBy  = CPublic.GetuserID();
                Cat.ModifiedBy = CPublic.GetuserID();


                OutputMessage result = null;

                if (Cat.ID == 0)
                {
                    result = Cat.Save();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
                else
                {
                    result = Cat.Update();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
            }
            catch (FormatException)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('Enter a Valid Order')", true);
            }
        }
        protected void btnSaveConfirmed_Click(object sender, EventArgs e)
        {
            try
            {
                Entities.Payroll.SalaryComponent sal = new Entities.Payroll.SalaryComponent();
                sal.ID              = Convert.ToInt32(hdSalId.Value);
                sal.Name            = txtName.Text.Trim();
                sal.ComponentType   = Convert.ToString(ddlCompType.SelectedValue);
                sal.CalculationType = Convert.ToString(ddlCalcType.SelectedValue);
                sal.Status          = Convert.ToInt32(ddlStatus.SelectedValue);
                sal.CompanyId       = CPublic.GetCompanyID();
                sal.CreatedBy       = CPublic.GetuserID();
                sal.ModifiedBy      = CPublic.GetuserID();

                Entities.OutputMessage result = null;
                if (sal.ID == 0)
                {
                    result = sal.Save();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
                else
                {
                    result = sal.Update();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 10
0
 protected void btnSaveConfirmed_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.Master.Vehicle vehicle = new Entities.Master.Vehicle();
         vehicle.ID         = Convert.ToInt32(hdVehicleId.Value);
         vehicle.Name       = txtName.Text.Trim();
         vehicle.Number     = txtNumber.Text.Trim();
         vehicle.Type       = txtType.Text.Trim();
         vehicle.Owner      = txtOwner.Text.Trim();
         vehicle.Status     = Convert.ToInt32(ddlStatus.SelectedValue);
         vehicle.CompanyId  = CPublic.GetCompanyID();
         vehicle.CreatedBy  = CPublic.GetuserID();
         vehicle.ModifiedBy = CPublic.GetuserID();
         OutputMessage result = null;
         if (vehicle.ID == 0)
         {
             result = vehicle.Save();
             if (result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(GetType(), "message", "successAlert('" + result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
             }
         }
         else
         {
             result = vehicle.Update();
             if (result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
             }
         }
     }
     catch (Exception ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + ex.Message + "')", true);
     }
 }
Ejemplo n.º 11
0
        protected void btnSaveConfirmed_Click(object sender, EventArgs e)
        {
            try
            {
                ProductType proType = new ProductType();
                proType.ID         = Convert.ToInt32(hdItemId.Value);
                proType.Name       = txtTypeName.Text.Trim();
                proType.Order      = Convert.ToInt32(txtTypeOrder.Text.Trim());
                proType.Status     = Convert.ToInt32(ddlTypeStatus.SelectedValue);
                proType.companyId  = CPublic.GetCompanyID();
                proType.CreatedBy  = CPublic.GetuserID();
                proType.Modifiedby = CPublic.GetuserID();


                OutputMessage result = null;
                if (proType.ID == 0)
                {
                    result = proType.Save();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
                else
                {
                    result = proType.Update();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 12
0
 protected void btnSaveConfirmed_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.Finance.ReportSettings Reports = new Entities.Finance.ReportSettings();
         Reports.ID             = Convert.ToInt32(hdItemId.Value);
         Reports.ReportID       = Convert.ToInt32(ddlReportType.SelectedValue);
         Reports.AccountGroupID = Convert.ToInt32(ddlAccountGroup.SelectedValue);
         Reports.Order          = Convert.ToInt32(txtAccountGroupOrder.Text);
         Reports.Postion        = Convert.ToInt32(ddlSide.SelectedValue);
         Reports.isMinus        = 1;
         Reports.CreatedBy      = CPublic.GetuserID();
         Reports.ModifiedBy     = CPublic.GetuserID();
         OutputMessage Result = null;
         if (Reports.ID == 0)
         {
             Result = Reports.Save();
             if (Result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
             }
         }
         else
         {
             Result = Reports.Update();
             if (Result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
             }
         }
     }
     catch (Exception)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('Something Went Wrong')", true);
     }
 }
Ejemplo n.º 13
0
 protected void btnSaveConfirmed_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.Tax tax = new Entities.Tax();
         tax.ID         = Convert.ToInt32(hdTaxId.Value);
         tax.Name       = txtTaxName.Text.Trim();
         tax.Percentage = Convert.ToDecimal(txtTaxPercentage.Text);
         tax.Type       = txtTaxType.Text.Trim();
         tax.Status     = Convert.ToInt32(ddlTaxStatus.SelectedValue);
         tax.CompanyId  = CPublic.GetCompanyID();
         tax.CreatedBy  = CPublic.GetuserID();
         tax.ModifiedBy = CPublic.GetuserID();
         OutputMessage result = null;
         if (tax.ID == 0)
         {
             result = tax.Save();
             if (result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
             }
         }
         else
         {
             result = tax.Update();
             if (result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
             }
         }
     }
     catch (Exception ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + ex.Message + " ')", true);
     }
 }
Ejemplo n.º 14
0
        protected void btnSaveConfirmed_Click(object sender, EventArgs e)
        {
            try
            {
                Entities.Payroll.HourlyTemplate hour = new Entities.Payroll.HourlyTemplate();
                hour.ID         = Convert.ToInt32(hdHourId.Value);
                hour.Title      = txtTitle.Text.Trim();
                hour.Rate       = Convert.ToDecimal(txtRate.Text.Trim());
                hour.Status     = Convert.ToInt32(ddlStatus.SelectedValue);
                hour.CompanyId  = CPublic.GetCompanyID();
                hour.CreatedBy  = CPublic.GetuserID();
                hour.ModifiedBy = CPublic.GetuserID();

                Entities.OutputMessage result = null;
                if (hour.ID == 0)
                {
                    result = hour.Save();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
                else
                {
                    result = hour.Update();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 15
0
 protected void btnSaveConfirmed_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.Payroll.Designation desig = new Entities.Payroll.Designation();
         desig.ID           = Convert.ToInt32(hdDesigId.Value);
         desig.Name         = txtDesignation.Text.Trim();
         desig.Status       = Convert.ToInt32(ddlStatus.SelectedValue);
         desig.DepartmentId = Convert.ToInt32(ddlDept.SelectedValue);
         desig.CompanyId    = CPublic.GetCompanyID();
         desig.CreatedBy    = CPublic.GetuserID();
         desig.ModifiedBy   = CPublic.GetuserID();
         OutputMessage result = null;
         if (desig.ID == 0)
         {
             result = desig.Save();
             if (result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
             }
         }
         else
         {
             result = desig.Update();
             if (result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "')", true);
             }
         }
     }
     catch (Exception ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + ex.Message + "')", true);
     }
 }
Ejemplo n.º 16
0
 protected void btnSaveConfirmed_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.Finance.CostCenter CostCenter = new Entities.Finance.CostCenter();
         CostCenter.ID         = Convert.ToInt32(hdItemId.Value);
         CostCenter.Name       = txtCostCenterName.Text;
         CostCenter.Status     = Convert.ToInt32(ddlDisabled.SelectedValue);
         CostCenter.CreatedBy  = CPublic.GetuserID();
         CostCenter.ModifiedBy = CPublic.GetuserID();
         OutputMessage Result = null;
         if (CostCenter.ID == 0)
         {
             Result = CostCenter.Save();
             if (Result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
             }
         }
         else
         {
             Result = CostCenter.Update();
             if (Result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
             }
         }
     }
     catch (Exception)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('Something Went Wrong')", true);
     }
 }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                int id         = Convert.ToInt32(Request.QueryString["id"]);
                int locationId = Convert.ToInt32(Request.QueryString["location"]);
                if (Request.QueryString["id"] != null && Request.QueryString["location"] != null)
                {
                    Entities.Register.SalesReturnRegister sq = new Entities.Register.SalesReturnRegister();
                    sq = Entities.Register.SalesReturnRegister.GetDetails(id, locationId);
                    dynamic setting           = Entities.Application.Settings.GetFeaturedSettings();
                    Entities.Master.Company c = new Entities.Master.Company();
                    c = Entities.Master.Company.GetDetailsByLocation(locationId);
                    Entities.Application.User use = new Entities.Application.User();
                    dynamic obj = Entities.Application.User.GetUserDetails(CPublic.GetuserID());
                    lblUserName.Text       = obj.UserName;
                    lblDesignation.Text    = obj.Designation;
                    lblCompanyContact.Text = obj.Mobile;
                    lblCompanyEmail.Text   = obj.Email;
                    imgLogo.ImageUrl       = "data:image/jpeg;base64, " + c.LogoBase64;
                    imgLogo1.ImageUrl      = "data:image/jpeg;base64, " + c.LogoBase64;
                    imgLogo2.ImageUrl      = "data:image/jpeg;base64, " + c.LogoBase64;
                    imgLogo3.ImageUrl      = "data:image/jpeg;base64, " + c.LogoBase64;

                    //lblCustName.Text = sq.CustomerName;
                    lblCompany.Text   = sq.Company;
                    lblCustemail.Text = sq.CustomerEmail;
                    lblCustState.Text = sq.CustomerState + "," + sq.CustomerCountry;
                    //lblCompanyContact.Text = c.MobileNo1;
                    //lblCompanyEmail.Text = sq.CompanyEmail;
                    lblDate.Text = sq.EntryDateString;
                    //lblReference.Text = sq.CreditNoteNumber;
                    //tAndC.Text = sq.TermsandConditon;
                    //lblCustCompany.Text = sq.CustomerName;
                    for (int i = 0; i < sq.Products.Count; i++)
                    {
                        TableRow r = new TableRow();
                        //TableCell t1 = new TableCell();
                        //t1.Text = (i + 1).ToString();
                        //r.Cells.Add(t1);
                        TableCell t2 = new TableCell();
                        t2.Text = sq.Products[i].ItemCode;
                        r.Cells.Add(t2);
                        //TableCell t3 = new TableCell();
                        //t3.Text = sq.Products[i].Name;
                        //r.Cells.Add(t3);
                        if (setting.EnableDescription)//Enabled Description
                        {
                            TableCell t3 = new TableCell();
                            t3.Width = 500;
                            string itemName = "<b>";
                            itemName += sq.Products[i].Name;
                            itemName += "</b><br/>";
                            itemName += sq.Products[i].Description;
                            t3.Text   = itemName;
                            r.Cells.Add(t3);
                        }
                        else
                        {
                            TableCell t3 = new TableCell();
                            t3.Text = sq.Products[i].Name;
                            r.Cells.Add(t3);
                        }
                        TableCell t4 = new TableCell();
                        t4.Text = sq.Products[i].Quantity.ToString();
                        r.Cells.Add(t4);
                        //TableCell t5 = new TableCell();
                        //t5.Text = sq.Products[i].MRP.ToString();
                        //r.Cells.Add(t5);
                        TableCell t6 = new TableCell();
                        t6.Text = sq.Products[i].SellingPrice.ToString();
                        r.Cells.Add(t6);
                        //TableCell t7 = new TableCell();
                        //t7.Text = sq.Products[i].TaxPercentage.ToString();
                        //r.Cells.Add(t7);
                        //TableCell t8 = new TableCell();
                        //t8.Text = sq.Products[i].Gross.ToString();
                        //r.Cells.Add(t8);
                        //TableCell t9 = new TableCell();
                        //t9.Text = sq.Products[i].TaxAmount.ToString();
                        //r.Cells.Add(t9);
                        TableCell t10 = new TableCell();
                        t10.Text = sq.Products[i].NetAmount.ToString();
                        r.Cells.Add(t10);
                        listTable.Rows.Add(r);
                    }
                    TableFooterRow tf = new TableFooterRow();
                    //TableCell tfc1 = new TableCell();
                    //tf.Cells.Add(tfc1);
                    //TableCell tfc2 = new TableCell();
                    //tf.Cells.Add(tfc2);
                    //TableCell tfc3 = new TableCell();
                    //tf.Cells.Add(tfc3);
                    //TableCell tfc4 = new TableCell();
                    //tf.Cells.Add(tfc4);
                    TableCell tfc5 = new TableCell();
                    tfc5.Text            = "Total in " + setting.CurrencySymbol;
                    tfc5.ColumnSpan      = 4;
                    tfc5.HorizontalAlign = HorizontalAlign.Right;
                    tf.Cells.Add(tfc5);
                    TableCell tfc6 = new TableCell();
                    tfc6.Text            = Convert.ToString(sq.Gross);
                    tfc6.HorizontalAlign = HorizontalAlign.Right;
                    tf.Cells.Add(tfc6);
                    listTable.Rows.Add(tf);
                    TableFooterRow TaxAmountcell = new TableFooterRow();
                    TableCell      tfc1          = new TableCell();
                    tfc1.Text            = "VAT AMOUNT";
                    tfc1.ColumnSpan      = 4;
                    tfc1.HorizontalAlign = HorizontalAlign.Right;
                    TaxAmountcell.Cells.Add(tfc1);
                    TableCell tfc2 = new TableCell();
                    tfc2.Text            = Convert.ToString(sq.TaxAmount);
                    tfc2.HorizontalAlign = HorizontalAlign.Right;
                    TaxAmountcell.Cells.Add(tfc2);
                    listTable.Rows.Add(TaxAmountcell);
                    TableFooterRow TotalCell = new TableFooterRow();
                    TableCell      tfc3      = new TableCell();
                    tfc3.Text            = "Grand Total in " + setting.CurrencySymbol;
                    tfc3.ColumnSpan      = 4;
                    tfc3.HorizontalAlign = HorizontalAlign.Right;
                    TotalCell.Cells.Add(tfc3);
                    TableCell tfc4 = new TableCell();
                    tfc4.Text            = Convert.ToString(sq.NetAmount);
                    tfc4.HorizontalAlign = HorizontalAlign.Right;
                    TotalCell.Cells.Add(tfc4);
                    listTable.Rows.Add(TotalCell);
                }
            }
            catch (Exception ex)
            {
                Entities.Application.Helper.LogException(ex, "Quote | Page_Load(object sender, EventArgs e)");
                Response.Write("<script> alert('" + ex.Message + "') </script>");
            }
        }
Ejemplo n.º 18
0
        private OutputMessage UpdateExpense()
        {
            try
            {
                Entities.Finance.VoucherEntry Expense = new Entities.Finance.VoucherEntry();
                DataSet       dsTemp     = new DataSet();
                StringBuilder StrVType   = new StringBuilder();
                StringBuilder StrAccID   = new StringBuilder();
                StringBuilder StrChdID   = new StringBuilder();
                StringBuilder StrAmount  = new StringBuilder();
                StringBuilder StrCostCtr = new StringBuilder();
                Expense.CreatedBy = CPublic.GetuserID();

                if (ViewState["DSTemp"] != null)
                {
                    dsTemp = (DataSet)ViewState["DSTemp"];
                }
                if (dsTemp != null && dsTemp.Tables[0].Rows.Count > 0)
                {
                    DataRow row;
                    for (int i = 0; i < dsTemp.Tables[0].Rows.Count; i++)
                    {
                        row = dsTemp.Tables[0].Rows[i];
                        if (Convert.ToString(row["CreditOrDebit"]) != "")
                        {
                            if (StrVType.ToString() == "")
                            {
                                StrVType.Append(Convert.ToString(row["CreditOrDebit"]));
                            }
                            else
                            {
                                StrVType.Append("|" + Convert.ToString(row["CreditOrDebit"]));
                            }
                        }
                        if (Convert.ToString(row["ParticularsID"]) != "")
                        {
                            if (StrAccID.ToString() == "")
                            {
                                StrAccID.Append(Convert.ToString(row["ParticularsID"]));
                            }
                            else
                            {
                                StrAccID.Append("|" + Convert.ToString(row["ParticularsID"]));
                            }
                        }


                        if (Convert.ToString(row["CostHead"]) != "")    //row["CostHead"]
                        {
                            if (StrChdID.ToString() == "")
                            {
                                StrChdID.Append(Convert.ToString(row["CostHead"]));  //row["CostHead"]
                            }
                            else
                            {
                                StrChdID.Append("|" + Convert.ToString(row["CostHead"]));  //row["CostHead"]
                            }
                        }

                        if (Convert.ToString(row["Amount"]) != "")
                        {
                            if (StrAmount.ToString() == "")
                            {
                                StrAmount.Append(Convert.ToString(row["Amount"]));
                            }
                            else
                            {
                                StrAmount.Append("|" + Convert.ToString(row["Amount"]));
                            }
                        }
                        if (Convert.ToString(row["CostCenter"]) != "")
                        {
                            if (StrCostCtr.ToString() == "")
                            {
                                StrCostCtr.Append(Convert.ToString(row["CostCenter"]));
                            }
                            else
                            {
                                StrCostCtr.Append("|" + Convert.ToString(row["CostCenter"]));
                            }
                        }
                    }
                }

                Expense.Date        = DateTime.Now;
                Expense.username    = Convert.ToString(Session["UserName"]);
                Expense.Description = txtnarration.Text;

                Expense.IsCheque   = 0;
                Expense.ChequeNo   = "";
                Expense.ChequeDate = DateTime.MinValue;
                if (txtNumber.ReadOnly == true)
                {
                    if (txtNumber.Text.Trim() == "")
                    {
                        Expense.VoucherNo = 0;
                    }
                    else
                    {
                        Expense.VoucherNo = Convert.ToInt32(txtNumber.Text);
                    }
                }


                Expense.VoucherTypeID = Convert.ToInt32(ddlVoucherType.SelectedValue);
                Expense.VoucherType   = StrVType.ToString();
                Expense.AccountHead   = StrAccID.ToString();
                Expense.AccountChild  = StrChdID.ToString();
                Expense.Amount        = StrAmount.ToString();
                Expense.CostCenter    = StrCostCtr.ToString();
                Expense.ModifiedBy    = CPublic.GetuserID();
                Expense.ID            = Convert.ToInt32(hdItemId.Value);
                DataSet       dsVoucherEntryDet = new DataSet();
                OutputMessage result            = null;
                result = Expense.Update(StrVType.ToString(), StrAccID.ToString(), StrChdID.ToString(), StrAmount.ToString(), StrCostCtr.ToString());
                return(result);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Ejemplo n.º 19
0
        private OutputMessage SaveVoucherEntry()
        {
            try
            {
                OutputMessage result = null;
                Entities.Finance.VoucherEntry Voucher = new Entities.Finance.VoucherEntry();
                Voucher.CreatedBy = CPublic.GetuserID();
                DataSet       dsTemp     = new DataSet();
                StringBuilder StrVType   = new StringBuilder();
                StringBuilder StrAccID   = new StringBuilder();
                StringBuilder StrChdID   = new StringBuilder();
                StringBuilder StrAmount  = new StringBuilder();
                StringBuilder StrCostCtr = new StringBuilder();
                if (ViewState["DSTemp"] != null)
                {
                    dsTemp = (DataSet)ViewState["DSTemp"];
                }
                if (dsTemp != null && dsTemp.Tables[0].Rows.Count > 0)
                {
                    DataRow row;
                    for (int i = 0; i < dsTemp.Tables[0].Rows.Count; i++)
                    {
                        row = dsTemp.Tables[0].Rows[i];
                        if (Convert.ToString(row["CreditOrDebit"]) != "")
                        {
                            if (StrVType.ToString() == "")
                            {
                                StrVType.Append(Convert.ToString(row["CreditOrDebit"]));
                            }
                            else
                            {
                                StrVType.Append("|" + Convert.ToString(row["CreditOrDebit"]));
                            }
                        }
                        if (Convert.ToString(row["ParticularsID"]) != "")
                        {
                            if (StrAccID.ToString() == "")
                            {
                                StrAccID.Append(Convert.ToString(row["ParticularsID"]));
                            }
                            else
                            {
                                StrAccID.Append("|" + Convert.ToString(row["ParticularsID"]));
                            }
                        }
                        if (Convert.ToString(row["CostHead"]) != "")
                        {
                            if (StrChdID.ToString() == "")
                            {
                                StrChdID.Append(Convert.ToString(row["CostHead"]));
                            }
                            else
                            {
                                StrChdID.Append("|" + Convert.ToString(row["CostHead"]));
                            }
                        }
                        if (Convert.ToString(row["Amount"]) != "")
                        {
                            if (StrAmount.ToString() == "")
                            {
                                StrAmount.Append(Convert.ToString(row["Amount"]));
                            }
                            else
                            {
                                StrAmount.Append("|" + Convert.ToString(row["Amount"]));
                            }
                        }
                        if (Convert.ToString(row["CostCenter"]) != "")
                        {
                            if (StrCostCtr.ToString() == "")
                            {
                                StrCostCtr.Append(Convert.ToString(row["CostCenter"]));
                            }
                            else
                            {
                                StrCostCtr.Append("|" + Convert.ToString(row["CostCenter"]));
                            }
                        }
                    }
                }
                //string Vtype = "", StrAccID="", StrChdID="", StrAmount="", StrCostCtr="";
                //if (ViewState["DSTemp"] != null)
                //{
                //    dsTemp = (DataSet)ViewState["DSTemp"];
                //}
                //if (dsTemp != null && dsTemp.Tables[0].Rows.Count > 0)
                //{
                //    DataRow row;
                //    for (int i = 0; i < dsTemp.Tables[0].Rows.Count; i++)
                //    {
                //        Voucher.Frm_TransID = 0;
                //        Voucher.ToTransID = 0;
                //        Voucher.FrmTransChildID = 0;
                //        Voucher.ToTransChildID = 0;
                //        row = dsTemp.Tables[0].Rows[i];
                //        //if (Convert.ToString(row["CreditOrDebit"]) != "")
                //        //{
                //        //    //Voucher.VoucherType = Convert.ToString(row["CreditOrDebit"]);
                //        //    Vtype += Convert.ToString(row["CreditOrDebit"]) + "|";
                //        //}
                //        //if (Convert.ToString(row["ParticularsID"]) != "")
                //        //{

                //        //    StrAccID += Convert.ToInt32(row["ParticularsID"]) + "|";
                //        //    //if (Voucher.VoucherType=="1")
                //        //    //{

                //        //    //    //Voucher.Frm_TransID = Convert.ToInt32(row["ParticularsID"]);
                //        //    //}
                //        //    //else
                //        //    //{
                //        //    //    StrAccID += Convert.ToInt32(row["ParticularsID"]) + "|";
                //        //    //    Voucher.ToTransID = Convert.ToInt32(row["ParticularsID"]);
                //        //    //}
                //        //}
                //        if (Convert.ToString(row["CostHead"]) != ""||Convert.ToString(row["CostHead"])!="0")    //row["CostHead"]
                //        {
                //            if (Voucher.VoucherType == "0")
                //            {
                //                if (Voucher.Frm_TransID!=0)
                //                {
                //                     Voucher.FrmTransChildID = Convert.ToInt32(row["CostHead"]);
                //                }
                //                else
                //                {
                //                    //Voucher.FrmTransChildID == 0 ? null : Convert.ToInt32(row["CostHead"]);
                //                }
                //            }
                //            else
                //            {
                //                Voucher.ToTransChildID = Convert.ToInt32(row["CostHead"]);
                //            }
                //        }
                //        if (Convert.ToString(row["Amount"]) != "")
                //        {
                //            Voucher.AmountNew = Convert.ToDecimal(row["Amount"]);
                //        }
                //        if (Convert.ToString(row["CostCenter"]) != "")
                //        {
                //            Voucher.CostCenter = Convert.ToString(row["CostCenter"]);
                //        }
                Voucher.Date          = Convert.ToDateTime(txtDate.Text); //DateTime.Now.ToString();
                Voucher.username      = Convert.ToString(Session["UserName"]);
                Voucher.Description   = txtnarration.Text;
                Voucher.IsCheque      = 0;
                Voucher.ChequeNo      = "";
                Voucher.ChequeDate    = null;
                Voucher.IsVoucher     = 1;
                Voucher.VoucherTypeID = Convert.ToInt32(ddlVoucherType.SelectedValue);
                if (txtNumber.ReadOnly == true)
                {
                    if (txtNumber.Text.Trim() == "")
                    {
                        Voucher.VoucherNo = 0;
                    }
                    else
                    {
                        Voucher.VoucherNo = Convert.ToInt32(txtNumber.Text);
                    }
                }
                //        Voucher.groupID = Convert.ToInt32(hdnGroupID.Value);
                //    }
                result = Voucher.Save(Convert.ToString(StrVType), Convert.ToString(StrAccID), Convert.ToString(StrChdID), Convert.ToString(StrAmount), Convert.ToString(StrCostCtr), "", "");
                //    hdnGroupID.Value = Convert.ToString(result.Object);
                //}
                return(result);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Ejemplo n.º 20
0
 private OutputMessage UpdateVoucher()
 {
     try
     {
         OutputMessage result = null;
         Entities.Finance.VoucherEntry Voucher = new Entities.Finance.VoucherEntry();
         Voucher.CreatedBy = CPublic.GetuserID();
         DataSet dsTemp = new DataSet();
         if (ViewState["DSTemp"] != null)
         {
             dsTemp = (DataSet)ViewState["DSTemp"];
         }
         if (dsTemp != null && dsTemp.Tables[0].Rows.Count > 0)
         {
             DataRow row;
             Voucher.DeleteVoucher(Convert.ToInt32(hdItemId.Value));
             for (int i = 0; i < dsTemp.Tables[0].Rows.Count; i++)
             {
                 Voucher.Frm_TransID     = 0;
                 Voucher.ToTransID       = 0;
                 Voucher.FrmTransChildID = 0;
                 Voucher.ToTransChildID  = 0;
                 row = dsTemp.Tables[0].Rows[i];
                 if (Convert.ToString(row["CreditOrDebit"]) != "")
                 {
                     Voucher.VoucherType = Convert.ToString(row["CreditOrDebit"]);
                 }
                 if (Convert.ToString(row["ParticularsID"]) != "")
                 {
                     if (Voucher.VoucherType == "0")
                     {
                         Voucher.Frm_TransID = Convert.ToInt32(row["ParticularsID"]);
                     }
                     else
                     {
                         Voucher.ToTransID = Convert.ToInt32(row["ParticularsID"]);
                     }
                 }
                 if (Convert.ToString(row["CostHead"]) != "")    //row["CostHead"]
                 {
                     if (Voucher.VoucherType == "0")
                     {
                         if (Voucher.Frm_TransID != 0)
                         {
                             Voucher.FrmTransChildID = Convert.ToInt32(row["CostHead"]);
                         }
                         else
                         {
                             //Voucher.FrmTransChildID == 0 ? null : Convert.ToInt32(row["CostHead"]);
                         }
                     }
                     else
                     {
                         Voucher.ToTransChildID = Convert.ToInt32(row["CostHead"]);
                     }
                 }
                 if (Convert.ToString(row["Amount"]) != "")
                 {
                     Voucher.AmountNew = Convert.ToDecimal(row["Amount"]);
                 }
                 if (Convert.ToString(row["CostCenter"]) != "")
                 {
                     Voucher.CostCenter = Convert.ToString(row["CostCenter"]);
                 }
                 Voucher.Date          = Convert.ToDateTime(txtDate.Text); //DateTime.Now.ToString();
                 Voucher.username      = Convert.ToString(Session["UserName"]);
                 Voucher.Description   = txtnarration.Text;
                 Voucher.IsCheque      = 0;
                 Voucher.ChequeNo      = "";
                 Voucher.ChequeDate    = null;
                 Voucher.IsVoucher     = 1;
                 Voucher.VoucherTypeID = Convert.ToInt32(ddlVoucherType.SelectedValue);
                 if (txtNumber.ReadOnly == true)
                 {
                     if (txtNumber.Text.Trim() == "")
                     {
                         Voucher.VoucherNo = 0;
                     }
                     else
                     {
                         Voucher.VoucherNo = Convert.ToInt32(txtNumber.Text);
                     }
                 }
                 Voucher.groupID = Convert.ToInt32(hdItemId.Value);
                 result          = Voucher.Save();
                 //hdnGroupID.Value = Convert.ToString(result.Object);
             }
         }
         return(result);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Ejemplo n.º 21
0
        private void UpdateVoucherEntry()
        {
            //if (hdnIsVoucher.Value == "1")
            //{
            try
            {
                Entities.Finance.VoucherEdit voucher = new Entities.Finance.VoucherEdit();
                int      GroupID = 0, VoucherID = 0, IsCheque = 0;
                DateTime VoucherDate = DateTime.UtcNow;
                DateTime?ChqDate = null;

                string ChqNumber = "", Narration = "", UserID = "";

                if (string.IsNullOrEmpty(txtNarration.Text))
                {
                }

                if (rblIsCheque.SelectedValue == "1" && (string.IsNullOrEmpty(txtChequeNumber.Text)))
                {
                }



                try
                {
                    GroupID     = Convert.ToInt32(hdnGroupID.Value);
                    VoucherID   = Convert.ToInt32(ddlVoucherType.SelectedValue);
                    VoucherDate = Convert.ToDateTime(txtVoucherDate.Text);
                    IsCheque    = Convert.ToInt32(rblIsCheque.SelectedValue);
                    //CostCenterID = Convert.ToInt32(ddlCostCenterID.SelectedValue);
                    ChqNumber = txtChequeNumber.Text;

                    if (IsCheque == 1)
                    {
                        ChqDate = Convert.ToDateTime(txtChequeDate.Text);
                    }
                    else
                    {
                        ChqDate   = null;
                        ChqNumber = "";
                    }

                    Narration = txtNarration.Text;
                    UserID    = CPublic.GetuserID().ToString();
                }
                catch
                {
                }
                OutputMessage Result = null;
                Result = voucher.UpdateVoucherEntry(GroupID, VoucherID, VoucherDate, IsCheque, ChqNumber, ChqDate, Narration, UserID);
                if (Result.Success)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
                }
                //}
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 22
0
        private void UpdateVoucher()
        {
            try
            {
                String ObjectID = "", ChildAccountID = "", DrAmount = "", CrAmount = "";
                for (int i = 0; i < grdVoucher.Rows.Count; i++)
                {
                    if (ObjectID == "")
                    {
                        ObjectID = ((Label)grdVoucher.Rows[i].FindControl("ObjectID")).Text;
                    }
                    else
                    {
                        ObjectID = ObjectID + "|" + ((Label)grdVoucher.Rows[i].FindControl("ObjectID")).Text;
                    }

                    if (((DropDownList)grdVoucher.Rows[i].FindControl("ddlChildHead")).Visible == true)
                    {
                        if (ChildAccountID == "")
                        {
                            ChildAccountID = ((DropDownList)grdVoucher.Rows[i].FindControl("ddlChildHead")).SelectedValue;
                        }
                        else
                        {
                            ChildAccountID = ChildAccountID + "|" + ((DropDownList)grdVoucher.Rows[i].FindControl("ddlChildHead")).SelectedValue;
                        }
                    }
                    else
                    {
                        if (ChildAccountID == "")
                        {
                            ChildAccountID = "0";
                        }
                        else
                        {
                            ChildAccountID = ChildAccountID + "|" + "0";
                        }
                    }

                    if (DrAmount == "")
                    {
                        DrAmount = ((TextBox)grdVoucher.Rows[i].FindControl("txtDr")).Text;
                    }
                    else
                    {
                        DrAmount = DrAmount + "|" + ((TextBox)grdVoucher.Rows[i].FindControl("txtDr")).Text;
                    }

                    if (CrAmount == "")
                    {
                        CrAmount = ((TextBox)grdVoucher.Rows[i].FindControl("txtCr")).Text;
                    }
                    else
                    {
                        CrAmount = CrAmount + "|" + ((TextBox)grdVoucher.Rows[i].FindControl("txtCr")).Text;
                    }
                }


                if (!String.IsNullOrEmpty(ObjectID))
                {
                    Entities.Finance.VoucherEdit voucher = new Entities.Finance.VoucherEdit();
                    OutputMessage Result = null;
                    voucher.ModifiedBy = CPublic.GetuserID();
                    voucher.ID         = Convert.ToInt32(hdnGroupID.Value);
                    Result             = voucher.UpdateVoucher(ObjectID, ChildAccountID, DrAmount, CrAmount);
                }
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 23
0
        protected void btnSaveConfirmed_Click(object sender, EventArgs e)
        {
            try
            {
                Entities.Finance.VoucherSettings Voucher = new Entities.Finance.VoucherSettings();
                string ByGroup = "", TypeId = "", HeadID = "", AllowCr = "", AllowDr = "", CrPartial = "", DrPartial = "";
                string chkSelectDrIndex = "", chkSelectCrIndex = "", partialDr = "", partialCr = "";
                TypeId  = ddlVoucherType.SelectedValue;
                ByGroup = ddlgroupBy.SelectedValue;
                foreach (GridViewRow dgi in this.gvAccounts.Rows)
                {
                    if (HeadID == "")
                    {
                        HeadID = Convert.ToString(((Label)dgi.FindControl("lblId")).Text);
                    }
                    else
                    {
                        HeadID = HeadID + "|" + Convert.ToString(((Label)dgi.FindControl("lblId")).Text);
                    }

                    if (((HtmlInputCheckBox)dgi.FindControl("chkSelectDr")).Checked)
                    {
                        chkSelectDrIndex = "1";
                    }
                    //chkSelectDrIndex = chkSelectDrIndex + "," + ((HtmlInputCheckBox)dgi.FindControl("chkSelectDr")).Value;
                    else
                    {
                        chkSelectDrIndex = "0";
                    }

                    if (((HtmlInputCheckBox)dgi.FindControl("chkSelectCr")).Checked)
                    {
                        chkSelectCrIndex = "1";
                    }
                    //chkSelectCrIndex = chkSelectCrIndex + "," + ((HtmlInputCheckBox)dgi.FindControl("chkSelectCr")).Value;
                    else
                    {
                        chkSelectCrIndex = "0";
                    }

                    if (AllowCr == "")
                    {
                        AllowCr = chkSelectCrIndex;
                    }
                    else
                    {
                        AllowCr = AllowCr + "|" + chkSelectCrIndex;
                    }

                    if (AllowDr == "")
                    {
                        AllowDr = chkSelectDrIndex;
                    }
                    else
                    {
                        AllowDr = AllowDr + "|" + chkSelectDrIndex;
                    }

                    if (dgi.Cells[2].BackColor == System.Drawing.Color.DimGray && ((HtmlInputCheckBox)dgi.FindControl("chkSelectDr")).Checked == true)
                    {
                        partialDr = "1";
                    }
                    else
                    {
                        partialDr = "0";
                    }

                    if (dgi.Cells[3].BackColor == System.Drawing.Color.DimGray && ((HtmlInputCheckBox)dgi.FindControl("chkSelectCr")).Checked == true)
                    {
                        partialCr = "1";
                    }
                    else
                    {
                        partialCr = "0";
                    }

                    if (DrPartial == "")
                    {
                        DrPartial = partialDr;
                    }
                    else
                    {
                        DrPartial = DrPartial + "|" + partialDr;
                    }

                    if (CrPartial == "")
                    {
                        CrPartial = partialCr;
                    }
                    else
                    {
                        CrPartial = CrPartial + "|" + partialCr;
                    }
                }
                OutputMessage Result = null;
                Voucher.CreatedBy = CPublic.GetuserID();
                if (Voucher.ID == 0)
                {
                    Result = Voucher.Save(ByGroup, TypeId, HeadID, AllowDr, AllowCr, CrPartial, DrPartial);
                    if (Result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
                    }
                }
                else
                {
                    Response.Write("<script>alert('')</script>");
                }
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 24
0
        protected void btnSaveConfirmed_Click(object sender, EventArgs e)
        {
            try
            {
                Entities.Application.User user = new Entities.Application.User();
                user.ID                  = Convert.ToInt32(hdUserId.Value);
                user.UserName            = txtUName.Text.Trim();
                user.Password            = txtPassword.Text.Trim();
                user.FullName            = txtFullName.Text.Trim();
                user.EmployeeId          = ddlEmpName.SelectedValue;
                user.ExpiryPeriod        = Convert.ToInt32(ddlDays.SelectedValue);
                user.ForcePasswordChange = chkExpiry.Checked;
                user.CreatedBy           = CPublic.GetuserID();
                user.Disable             = chkDisable.Checked;
                user.LocationId          = Convert.ToInt32(ddlLoc.SelectedValue);
                user.ModifiedBy          = CPublic.GetuserID();
                user.CompanyId           = CPublic.GetCompanyID();
                OutputMessage result = null;


                if (user.ID == 0)
                {
                    result = user.Save();
                    if (txtConfirmPass.Text != txtPassword.Text)
                    {
                        result = user.Authenticate();
                        if (result.Success)
                        {
                            ClientScript.RegisterStartupScript(GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "');$('#add-item-portlet').addClass('in');", true);
                        }

                        else
                        {
                            result = user.Authenticate();
                            ClientScript.RegisterStartupScript(GetType(), "message", "successAlert('" + result.Message + "');", true);
                        }
                    }
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "');$('#add-item-portlet').addClass('in');", true);
                    }
                }
                else
                {
                    result = user.Update();
                    if (result.Success)
                    {
                        Reset();
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + result.Message + "');", true);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('" + result.Message + "');$('#add-item-portlet').addClass('in');", true);
                    }
                }
            }
            catch (FormatException ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", "$('#add-item-portlet').addClass('in');errorAlert('Enter a Valid Order');$('#add-item-portlet').addClass('in');", true);
            }
        }
Ejemplo n.º 25
0
 protected void btnSaveConfirmed_Click(object sender, EventArgs e)
 {
     try
     {
         Entities.Finance.AccountHeadMaster Account = new Entities.Finance.AccountHeadMaster();
         Account.ID             = Convert.ToInt32(hdItemId.Value);
         Account.Name           = txtAccountHeadName.Text;
         Account.status         = Convert.ToInt32(ddlStatus.SelectedValue);
         Account.Description    = txtDescription.Text;
         Account.IsDebit        = Convert.ToInt32(ddlIsDebit.SelectedValue);
         Account.ParentId       = 0;
         Account.CreatedBy      = CPublic.GetuserID();
         Account.Category       = Convert.ToInt32(ddlCategory.SelectedValue);
         Account.DataSQL        = txtDataSQL.Text;
         Account.SQLID          = txtDataID.Text;
         Account.SQLName        = txtDataName.Text;
         Account.SQLTable       = txtRefenerenceTable.Text;
         Account.TransactionSQL = txtTransactionSQL.Text;
         Account.AmountSQL      = txtAmountSQL.Text;
         Account.Phone          = txtPhoneNumber.Text;
         Account.Email          = txtEmail.Text;
         if (txtOpeningBalance.Text == "")
         {
             Account.OpeningBalance = 0;
         }
         else
         {
             Account.OpeningBalance = Convert.ToDecimal(txtOpeningBalance.Text);
         }
         if (txtOpeningDate.Text == "")
         {
             Account.OpeningDate = DateTime.UtcNow;
         }
         else
         {
             Account.OpeningDate = Convert.ToDateTime(txtOpeningDate.Text);
         }
         Account.CompanyID      = CPublic.GetCompanyID();
         Account.ModifiedBy     = CPublic.GetuserID();
         Account.AccountNature  = Convert.ToInt32(ddlAccountNature.SelectedValue);
         Account.AccountType    = Convert.ToInt32(ddlAccountType.SelectedValue);
         Account.Address        = txtAddress.Text;
         Account.ContactPerson  = txtContactPerson.Text;
         Account.AccountGroupId = Convert.ToInt32(ddlParentGroup.SelectedValue);
         Account.ReverseHeadId  = Convert.ToInt32(ddlReverseHead.SelectedValue);
         OutputMessage Result = null;
         if (Account.ID == 0)
         {
             Result = Account.Save();
             if (Result.Success)
             {
                 Reset();
                 ddlReverseHead.LoadAccountHeads(CPublic.GetCompanyID());
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');window.setTimeout(function(){window.location.href = '/Finance/AccountHeadMaster';}, 3000);", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
             }
         }
         else
         {
             Result = Account.Update();
             if (Result.Success)
             {
                 Reset();
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "successAlert('" + Result.Message + "');window.setTimeout(function(){window.location.href = '/Finance/AccountHeadMaster';}, 3000);", true);
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "message", "errorAlert('" + Result.Message + "')", true);
             }
         }
     }
     catch (Exception ex)
     {
     }
 }