void fillGrid() { objplOpenStock = new ItemOpenningStockModel() { Ind = 32, OrgID = GlobalSession.OrgID, BrID = GlobalSession.BrID, YrCD = GlobalSession.YrCD, ItemID = Convert.ToInt32(ddlItemName.SelectedValue), }; string uri = string.Format("ItemOpenStock/FillGridItem"); DataTable FillGridItemName = CommonCls.ApiPostDataTable(uri, objplOpenStock); if (FillGridItemName.Rows.Count > 0) { //grdOpenStockEntry.DataSource = FillGridItemName; //grdOpenStockEntry.DataBind(); FillGridItemName.Columns["CompanyID"].SetOrdinal(0); FillGridItemName.Columns["WareHouseID"].SetOrdinal(1); FillGridItemName.Columns["Address"].SetOrdinal(2); FillGridItemName.Columns["ItemUnitID"].SetOrdinal(3); FillGridItemName.Columns["ItemOpeningQty"].SetOrdinal(4); FillGridItemName.Columns["ItemMinorUnitID"].SetOrdinal(5); FillGridItemName.Columns["ItemMinorUnitQty"].SetOrdinal(6); FillGridItemName.Columns["ItemOpeningRate"].SetOrdinal(7); FillGridItemName.Columns["ItemOpeningDate"].SetOrdinal(8); if (FillGridItemName.Columns.Contains("ItemOpeningRate1")) { FillGridItemName.Columns.Remove("ItemOpeningRate1"); } if (FillGridItemName.Columns.Contains("UnitName")) { FillGridItemName.Columns.Remove("UnitName"); } foreach (DataRow item in FillGridItemName.Rows) { item["ItemOpeningDate"] = CommonCls.ConvertToDate(item["ItemOpeningDate"].ToString()); } gridOpenStock.DataSource = VsDtOpenStock = FillGridItemName; gridOpenStock.DataBind(); } else { gridOpenStock.DataSource = null; gridOpenStock.DataBind(); //grdOpenStockEntry.DataSource = null; //grdOpenStockEntry.DataBind(); } }
protected void btnSave_Click(object sender, EventArgs e) { try { objBudgetYearActivation = new BudgetYearActivationModel(); objBudgetYearActivation.Ind = 1; objBudgetYearActivation.YrCode = 18; objBudgetYearActivation.YearFromTo = ddlFinancialYr.SelectedValue; objBudgetYearActivation.ActiveID = 1; objBudgetYearActivation.UserID = GlobalSession.UserID; objBudgetYearActivation.IPAddress = GlobalSession.IP; objBudgetYearActivation.AccountInd = 0; objBudgetYearActivation.BudgetInd = 1; objBudgetYearActivation.YrStartDate = CommonCls.ConvertToDate("01/04/2018"); objBudgetYearActivation.YrEndDate = CommonCls.ConvertToDate("31/03/2019"); objBudgetYearActivation.BudgetOrderNumber = txtOrderNo.Text; objBudgetYearActivation.BudgetOrderDate = CommonCls.ConvertToDate(txtOrderDate.Text); objBudgetYearActivation.AccountingOrderDate = ""; objBudgetYearActivation.AccountingOrderNumber = ""; objBudgetYearActivation.AccountingEntryDate = ""; string uri = string.Format("BudgetYearActivation/SaveFinancialYear"); DataTable dtYear = CommonCls.ApiPostDataTable(uri, objBudgetYearActivation); if (dtYear.Rows.Count > 0) { if (dtYear.Rows[0][0].ToString() == "1") { ShowMessage("Financial Year is Activated For Year" + ddlFinancialYr.SelectedValue, true); } } else { ShowMessage("Data is not saved successfully", false); } } catch (Exception ex) { ShowMessage(ex.Message, false); } }
void BindItemOSEGrid() { DataTable dtItemOSE = new DataTable(); if (ViewState["dtItemOSE"] == null) { dtItemOSE = DtItemOSESchema(); } else { dtItemOSE = (DataTable)ViewState["dtItemOSE"]; } DataRow DrItemOSE = dtItemOSE.NewRow(); DrItemOSE["OrgId"] = Convert.ToInt32(GlobalSession.OrgID); DrItemOSE["ItemID"] = 0; DrItemOSE["WarehouseId"] = Convert.ToInt32(ddlWarehouse.SelectedValue); DrItemOSE["WareHouseName"] = ddlWarehouse.SelectedItem.Text; DrItemOSE["OpeningUnit"] = CommonCls.ConvertIntZero(ddlPriUnit.SelectedValue);//ddlItemUnit.SelectedValue; DrItemOSE["OpeningQty"] = CommonCls.ConvertDecimalZero(txtOpeningQty.Text); if (GlobalSession.StockMaintaineByMinorUnit) { DrItemOSE["OpeningMinorUnit"] = CommonCls.ConvertIntZero(ddlSecUnit.SelectedValue);//ddlMinorUnit.SelectedValue; DrItemOSE["OpeningMinorQty"] = CommonCls.ConvertDecimalZero(txtSecQty.Text); } else { DrItemOSE["OpeningMinorUnit"] = 0; DrItemOSE["OpeningMinorQty"] = 0; } DrItemOSE["OpRate"] = CommonCls.ConvertDecimalZero(txtOpeningRate.Text); DrItemOSE["OpDate"] = CommonCls.ConvertToDate(txtOpeningDate.Text); dtItemOSE.Rows.Add(DrItemOSE); grdItemMaster.DataSource = ViewState["dtItemOSE"] = dtItemOSE; grdItemMaster.DataBind(); }
protected void btnAdd_Click(object sender, EventArgs e) { try { lblmsg.Text = lblmsg.CssClass = ""; if (CommonCls.ConvertIntZero(ddlItemName.SelectedValue) == 0) { ddlItemName.Focus(); ShowMessage("Fill Item Name..!", false); return; } if (CommonCls.ConvertIntZero(ddlwarehouse.SelectedValue) == 0) { ddlwarehouse.Focus(); ShowMessage("Select WareHouse ..!", false); return; } if (CommonCls.ConvertDecimalZero(txtPriQty.Text) == 0) { txtPriQty.Focus(); ShowMessage("Select Item Opening Quantity ..!", false); return; } if (CommonCls.ConvertDecimalZero(txtPriQty.Text) == 0) { txtPriQty.Focus(); txtPriQty.Text = ""; ShowMessage("Enter Opening Item Quantity..!", false); return; } if (CommonCls.ConvertDecimalZero(txtOpRate.Text) == 0) { txtOpRate.Focus(); txtOpRate.Text = ""; ShowMessage("Enter Item Rate..! ", false); return; } if (VsDtOpenStock == null) { VsDtOpenStock = createdtGrdDT(); } if (VsDtOpenStock.Rows.Count > 0) { foreach (DataRow row in VsDtOpenStock.Rows) { //decimal opRate = Convert.ToDecimal(row["OpRate"].ToString()); //int itemID = Convert.ToInt32(row["ItemID"].ToString()); //int Warehousetext = Convert.ToInt32(row["WareHouseId"].ToString()); decimal opRate = Convert.ToDecimal(row["ItemOpeningRate"].ToString()); int itemID = Convert.ToInt32(row["ItemUnitID"].ToString()); int Warehousetext = Convert.ToInt32(row["WareHouseID"].ToString()); if (Convert.ToInt32(ddlItemName.SelectedValue) == itemID && opRate == Convert.ToDecimal(txtOpRate.Text) && Warehousetext == Convert.ToInt32(ddlwarehouse.SelectedValue)) { ShowMessage("Rate allready exist for this item.", false); return; } } } DataRow dr = VsDtOpenStock.NewRow(); #region Old //dr["OrgId"] = GlobalSession.OrgID; //dr["ItemID"] = ddlItemName.SelectedValue; //dr["WareHouseId"] = ddlwarehouse.SelectedItem.Value; //dr["WareHouseName"] = ddlwarehouse.SelectedItem.Text; //dr["OpeningUnit"] = ddlPriUnit.SelectedValue; //dr["OpeningQty"] = txtPriQty.Text; //if (ddlsecunit.SelectedValue == "0") //{ // dr["OpeningMinorUnit"] = 0; //} //else //{ // dr["OpeningMinorUnit"] = ddlsecunit.SelectedValue; //} //dr["OpeningMinorQty"] = txtsecQty.Text; //dr["OpRate"] = txtOpRate.Text; //dr["OpDate"] = CommonCls.ConvertToDate(txtDate.Text); #endregion dr["CompanyID"] = GlobalSession.OrgID; dr["ItemUnitID"] = ddlItemName.SelectedValue; dr["WareHouseID"] = ddlwarehouse.SelectedItem.Value; dr["Address"] = ddlwarehouse.SelectedItem.Text; dr["ItemUnitID"] = ddlPriUnit.SelectedValue; dr["ItemOpeningQty"] = txtPriQty.Text; if (ddlsecunit.SelectedValue == "0") { dr["ItemMinorUnitID"] = 0; } else { dr["ItemMinorUnitID"] = ddlsecunit.SelectedValue; } dr["ItemMinorUnitQty"] = "0"; dr["ItemOpeningRate"] = txtOpRate.Text; dr["ItemOpeningDate"] = CommonCls.ConvertToDate(txtDate.Text); VsDtOpenStock.Rows.Add(dr); gridOpenStock.DataSource = VsDtOpenStock; gridOpenStock.DataBind(); clearGrid(); } catch (Exception ex) { ShowMessage(ex.Message, false); } }
protected void btnSave_Click(object sender, EventArgs e) { lblMsg.Text = lblMsg.CssClass = ""; bool IsValid = ValidationBtnSave(); if (!IsValid) { return; } bool chkUncheck = false; foreach (GridViewRow grdRow in grdReportFormats.Rows) { CheckBox chkSelectOnce = (CheckBox)grdRow.FindControl("chkSelectOnce"); if (chkSelectOnce.Checked == true) { hfFormatID.Value = ((Label)grdRow.FindControl("lblFormatID")).Text; chkUncheck = true; break; } } objPCModel = new ProfileCreationModel(); objPCModel.Ind = 1; objPCModel.CompName = txtCompanyName.Text; objPCModel.ShortName = txtShortName.Text; objPCModel.OrgType = Convert.ToInt32(ddlOrgType.SelectedValue); objPCModel.BusiNature = Convert.ToInt32(ddlBussiNature.SelectedValue); objPCModel.BusiType = Convert.ToInt32(ddlBussiType.SelectedValue); objPCModel.Addr = txtAddress.Text; objPCModel.City = txtCityCompany.Text; objPCModel.State = Convert.ToInt32(ddlStateCompany.SelectedValue); objPCModel.Pin = Convert.ToInt32(txtPincodeCompany.Text); objPCModel.Phone = txtLandLineNo.Text; objPCModel.Fax = txtFaxNo.Text; objPCModel.EMail = txtEmail.Text; objPCModel.PAN = txtPanNo.Text; objPCModel.TAN = txtTanNo.Text; objPCModel.CIN = txtCINNo.Text; objPCModel.IECode = txtImportExportCode.Text; objPCModel.ExportCtg = 0; objPCModel.ContactName = txtPersonName.Text; objPCModel.ContactDesg = txtDesiPerson.Text; objPCModel.ContactEmail = txtEmailPerson.Text; objPCModel.ContactMobile = txtMobileNoPerson.Text; objPCModel.AltPerson = txtPersonNameAlter.Text; objPCModel.AltPersonDesg = txtDesiPersonAlter.Text; objPCModel.AltPersonEmail = txtEmailPersonAlter.Text; objPCModel.AltMobile = txtMobileNoPersonAlter.Text; objPCModel.Composition = Convert.ToInt32(ddlComposiOpted.SelectedValue); objPCModel.CompositionDate = CommonCls.ConvertToDate(txtCompoEffDate.Text); objPCModel.GSTIN = string.IsNullOrEmpty(txtGSTIN.Text) ? "" : txtGSTIN.Text; objPCModel.RegDate = string.IsNullOrEmpty(CommonCls.ConvertToDate(txtRegDate.Text)) ? "" : CommonCls.ConvertToDate(txtRegDate.Text); objPCModel.RegAddr = string.IsNullOrEmpty(txtRegAddress.Text) ? "" : txtRegAddress.Text; objPCModel.RegCity = string.IsNullOrEmpty(txtCityGSTIN.Text) ? "" : txtCityGSTIN.Text; objPCModel.RegState = Convert.ToInt32(ddlStateGSTIN.SelectedValue) == 0 ? 0 : Convert.ToInt32(ddlStateGSTIN.SelectedValue); objPCModel.RegPin = string.IsNullOrEmpty(txtPincodeGSTIN.Text) ? 0 : Convert.ToInt32(txtPincodeGSTIN.Text); objPCModel.RegAuthPerson = txtAuthorizedSign.Text; objPCModel.RegAuthDesg = txtAuthorizedDesi.Text; objPCModel.InvoiceNoSeries = ""; //txtInvioceSeries.Text; objPCModel.InvoiceNo = 0; //string.IsNullOrEmpty(txtStartingNo.Text) ? 0 : Convert.ToInt32(txtStartingNo.Text); objPCModel.YrCD = GlobalSession.YrCD; objPCModel.User = GlobalSession.UserID; objPCModel.IP = GlobalSession.IP; objPCModel.InvoiceCaption1 = txtInvoiceCaption1.Text; objPCModel.InvoicePrint1 = Convert.ToInt32(ddlInvoicePrint1.SelectedValue); objPCModel.InvoiceCaption2 = txtInvoiceCaption2.Text; objPCModel.InvoicePrint2 = Convert.ToInt32(ddlInvoicePrint2.SelectedValue); objPCModel.InvoiceCaption3 = txtInvoiceCaption3.Text; objPCModel.InvoicePrint3 = Convert.ToInt32(ddlInvoicePrint3.SelectedValue); objPCModel.InvoiceCaption4 = txtInvoiceCaption4.Text; objPCModel.InvoicePrint4 = Convert.ToInt32(ddlInvoicePrint4.SelectedValue); objPCModel.InvoiceCaption5 = txtInvoiceCaption5.Text; objPCModel.InvoicePrint5 = Convert.ToInt32(ddlInvoicePrint5.SelectedValue); objPCModel.CompanyLogo = imgCompanyLogo.ImageUrl.Substring(imgCompanyLogo.ImageUrl.LastIndexOf("/") + 1); objPCModel.DtSeries = VsDtSeries; // Series Table objPCModel.UnRegistered = ddlCompanyType.SelectedValue == "1" ? 0 : ddlCompanyType.SelectedValue == "2" ? 0 : 1; objPCModel.CompanyType = Convert.ToInt32(ddlCompanyType.SelectedValue); objPCModel.TurnoverID = Convert.ToInt32(ddlTurnover.SelectedValue); objPCModel.TurnoverDescription = ddlTurnover.SelectedItem.Text; objPCModel.PrintHSNSACCode = Convert.ToInt32(ddlPrintTurnover.SelectedValue); objPCModel.BankName = txtBankName.Text; objPCModel.IFSCCode = txtIFSCCode.Text; objPCModel.AccountNumber = txtAccountNumber.Text; if (cbCopyType.Items[0].Selected) { objPCModel.InvoiceCopy1Header = cbCopyType.Items[0].Text; } if (cbCopyType.Items[1].Selected) { objPCModel.InvoiceCopy2Header = cbCopyType.Items[1].Text; } if (cbCopyType.Items[2].Selected) { objPCModel.InvoiceCopy3Header = cbCopyType.Items[2].Text; } if (cbCopyType.Items[3].Selected) { objPCModel.InvoiceCopy4Header = txtExtra1.Text; } if (cbCopyType.Items[4].Selected) { objPCModel.InvoiceCopy5Header = txtExtra2.Text; } objPCModel.InvoiceOnPrePrinted = Convert.ToInt32(ddlSIOnPrePrinted.SelectedValue); objPCModel.InvoiceCopyNo = string.IsNullOrEmpty(txtNoPrintedCopy.Text) ? 0 : Convert.ToInt32(txtNoPrintedCopy.Text); objPCModel.CompositionCategoryID = ddlCompositionCategory.SelectedItem == null ? 0 : Convert.ToInt32(ddlCompositionCategory.SelectedValue); if (VSDTCompositionCategory != null) // First Time DataTable Create For Grid { DataRow[] row = VSDTCompositionCategory.Select("CompositionCategoryID=" + Convert.ToInt32(ddlCompositionCategory.SelectedValue)); if (row.Count() > 0) { objPCModel.CompositionTaxRate = CommonCls.ConvertDecimalZero(row[0]["CompositionTaxRate"]); } } objPCModel.StcokMaintaneByMinorUnit = Convert.ToInt32(ddlStockMISecUnit.SelectedValue); if (chkUncheck == true) { objPCModel.ReportFormat = Convert.ToInt32(hfFormatID.Value); } else { lblMsg.Text = "Choose Invoice Format!"; ShowMessage(lblMsg.Text, false); return; } if (VSTerms != null) { objPCModel.DtTerms = VSTerms;//(DataTable)ViewState["dtTerms"]; } else { DataTable dtTerms = new DataTable(); dtTerms.Columns.Add("Terms", typeof(string)); dtTerms.Columns.Add("UserID", typeof(int)); dtTerms.Columns.Add("IP", typeof(string)); DataRow drTerms = dtTerms.NewRow(); drTerms["Terms"] = ""; drTerms["UserID"] = GlobalSession.UserID; drTerms["IP"] = GlobalSession.IP; dtTerms.Rows.Add(drTerms); objPCModel.DtTerms = dtTerms; } string uri = string.Format("ProfileCreation/SaveCompanyProfile"); DataTable dtSave = CommonCls.ApiPostDataTable(uri, objPCModel); if (dtSave.Rows.Count > 0) { if (dtSave.Rows[0]["RecordID"].ToString() == "0") { lblMsg.Text = "Record Not Save Please Try Again."; ShowMessage(lblMsg.Text, false); } else if (dtSave.Rows[0]["RecordID"].ToString() == "1") { ClearAll(); Response.Redirect("frmSuccessfullyProfileCreation.aspx?ProfileCreation=" + "Profile Create Successfully!&&OrgName=" + GlobalSession.OrgName); } else if (dtSave.Rows[0]["RecordID"].ToString() == "2") { lblMsg.Text = "Duplicate Record."; ShowMessage(lblMsg.Text, false); txtCompanyName.Focus(); } } else { lblMsg.Text = "Record Not Save Please Try Again."; ShowMessage(lblMsg.Text, false); } }