public static string LoadRegionCombo(string BranchID) { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlParameter Branch = new SqlParameter("@BranchID", BranchID); DataSet ds = AACommon.ReturnDatasetBySP("USER_MANAGER_GET_ALL_COMBO", Conn, Branch); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.ID = ds.Tables[0].Rows[i][0].ToString(); dbdc.Name = ds.Tables[0].Rows[i][1].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadRegion() { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); DataSet ds = AACommon.ReturnDatasetBySPWithoutParameter("ITM_UNIT_TYPE_Get", Conn); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.UnitTypeID = ds.Tables[0].Rows[i][0].ToString(); dbdc.UnitTypeDesc = ds.Tables[0].Rows[i][1].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadRegion(string BranchID) { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlDataAdapter da = new SqlDataAdapter("SELECT dbo.AccountTypeControl.ControlAccID, dbo.AccountTypeControl.ControlAccTitle, dbo.AccountsType.AccountTypeID, dbo.AccountsType.AccountTypeTitle FROM dbo.AccountsType INNER JOIN dbo.AccountTypeControl ON dbo.AccountsType.AccountTypeID = dbo.AccountTypeControl.AccountTypeID where dbo.AccountTypeControl.BranchID='" + BranchID + "' and dbo.AccountsType.BranchID='" + BranchID + "' ", Conn); DataSet ds = new DataSet(); da.Fill(ds); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.ITEMID = ds.Tables[0].Rows[i][0].ToString(); dbdc.ITEMName = ds.Tables[0].Rows[i][1].ToString(); dbdc.ItemCode = ds.Tables[0].Rows[i][2].ToString(); dbdc.BarCode = ds.Tables[0].Rows[i][3].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadRegion() { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); DataSet ds = AACommon.ReturnDatasetBySPWithoutParameter("Supplier_Get", Conn); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.SupplierID = ds.Tables[0].Rows[i][0].ToString(); dbdc.SupplierTitle = ds.Tables[0].Rows[i][1].ToString(); dbdc.SupplierCode = ds.Tables[0].Rows[i][2].ToString(); dbdc.Phone = ds.Tables[0].Rows[i][3].ToString(); dbdc.Fax = ds.Tables[0].Rows[i][4].ToString(); dbdc.Email = ds.Tables[0].Rows[i][5].ToString(); dbdc.AddressLine1 = ds.Tables[0].Rows[i][6].ToString(); dbdc.AddressLine2 = ds.Tables[0].Rows[i][7].ToString(); dbdc.NTN = ds.Tables[0].Rows[i][8].ToString(); dbdc.GST = ds.Tables[0].Rows[i][9].ToString(); dbdc.SRB = ds.Tables[0].Rows[i][10].ToString(); dbdc.OpBal = ds.Tables[0].Rows[i]["OpBal"].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadRegion(string BranchID) { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlParameter Branch = new SqlParameter("@BranchID", BranchID); DataSet ds = AACommon.ReturnDatasetBySP("ITM_ITEM_GET", Conn, Branch); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.ITEMID = ds.Tables[0].Rows[i]["ITEMID"].ToString(); dbdc.ITEMName = ds.Tables[0].Rows[i]["ITEMName"].ToString(); dbdc.ItemCode = ds.Tables[0].Rows[i]["ItemCode"].ToString(); dbdc.BarCode = ds.Tables[0].Rows[i]["BarCode"].ToString(); dbdc.Discription = ds.Tables[0].Rows[i]["Discription"].ToString(); dbdc.UnitTypeID = ds.Tables[0].Rows[i]["UnitTypeID"].ToString(); dbdc.Category = ds.Tables[0].Rows[i]["CatID"].ToString(); dbdc.Brand = ds.Tables[0].Rows[i]["BrandID"].ToString(); dbdc.CatTitle = ds.Tables[0].Rows[i]["CatTitle"].ToString(); dbdc.BrandTitle = ds.Tables[0].Rows[i]["BrandTitle"].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadRegion(string BranchID) { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlDataAdapter da = new SqlDataAdapter("select * from Category Where IsDelete=0 and BranchID='" + BranchID + "'", Conn); DataSet ds = new DataSet(); da.Fill(ds); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.UnitTypeID = ds.Tables[0].Rows[i][0].ToString(); dbdc.UnitTypeDesc = ds.Tables[0].Rows[i][1].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadOnwayHistory(string Product, string BranchID) { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlDataAdapter da = new SqlDataAdapter("select * from SP_MASTER_ON_WAY_HISTORY where SPID='" + Product + "' and BranchID='" + BranchID + "' Order by ID Desc", Conn); DataSet ds = new DataSet(); da.Fill(ds); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.Remarks = ds.Tables[0].Rows[i]["Remarks"].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadItem(string BranchID) { string acc = ""; string htmUNT = ""; string query = "select * from VW_ITEM_FOR_SALE where BranchID='" + BranchID + "' and BranchID2='" + BranchID + "' and BranchID3='" + BranchID + "' order by ITEMName"; SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlDataAdapter da = new SqlDataAdapter(query, Con); DataTable dt = new DataTable(); da.Fill(dt); //BreakingItemName(dt); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.ITEMID = dt.Rows[i]["ITEMID"].ToString(); dbdc.ITEMName = dt.Rows[i]["ITEMName"].ToString(); dbdc.Price = dt.Rows[i]["SalePrice"].ToString(); dbdc.Cost = dt.Rows[i]["PurchasePrice"].ToString(); RegionList.Insert(i, dbdc); } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); //for (int i = 1; i <= dt.Rows.Count; i++) //{ // string itmID = ""; // string UntTyp = ""; // if (dt.Rows.Count == 1) // { // itmID = dt.Rows[i - 1]["ITEMID"].ToString(); // UntTyp = dt.Rows[i - 1]["UnitTypeID"].ToString(); // if (i == 1) // { acc = acc + "['" + dt.Rows[i - 1]["ITEMName"].ToString() + "']"; } // } // else // { // itmID = dt.Rows[i - 1]["ITEMID"].ToString(); // UntTyp = dt.Rows[i - 1]["UnitTypeID"].ToString(); // if (i == 1) // { acc = acc + "['" + dt.Rows[i - 1]["ITEMName"].ToString() + "'"; } // else if (i != 1 && i < dt.Rows.Count) // { acc = acc + ",'" + dt.Rows[i - 1]["ITEMName"].ToString() + "'"; } // else // { acc = acc + ",'" + dt.Rows[i - 1]["ITEMName"].ToString() + "']"; } // } // htmUNT = htmUNT + LoadUNITS(itmID, UntTyp, BranchID); //} //acc = acc + "`" + LoadNUMBER("CS", "SP_MASTER", "SPID", Con, BranchID) + "`" + htmUNT; //return acc; }
public static string LoadItemData(string UserID, string BranchID, string Code) { string acc = ""; string htmUNT = ""; string query = "select * from VW_ITEM_FOR_SALE where BranchID='" + BranchID + "' and BranchID2='" + BranchID + "' and BranchID3='" + BranchID + "' and itemcode='" + Code + "' order by ITEMName"; SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlDataAdapter da = new SqlDataAdapter(query, Con); DataTable dt = new DataTable(); da.Fill(dt); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.ITEMID = dt.Rows[i]["ITEMID"].ToString(); dbdc.ITEMName = dt.Rows[i]["ITEMName"].ToString(); dbdc.Price = dt.Rows[i]["SalePrice"].ToString(); dbdc.Cost = dt.Rows[i]["PurchasePrice"].ToString(); RegionList.Insert(i, dbdc); } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadHead() { //string str = "select * from STP_Employee where IsDelete=0 order by FirstName"; string str = "select '0' AS UnitTypeID,' - - Select Multiplier Name ' AS UnitTypeDesc from ITM_UNIT_TYPE union select UnitTypeID,UnitTypeDesc from ITM_UNIT_TYPE where IsDelete=0 order by UnitTypeID "; SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlDataAdapter da = new SqlDataAdapter(str, Con); DataTable dt = new DataTable(); da.Fill(dt); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.ID = dt.Rows[i]["UnitTypeID"].ToString(); dbdc.Name = dt.Rows[i]["UnitTypeDesc"].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadOnway(string Product, string BranchID) { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlDataAdapter da = new SqlDataAdapter("select * from VW_ON_WAY_PENDING_DETAIL where SPID='" + Product + "' and BranchID='" + BranchID + "' and BranchID1='" + BranchID + "' and BranchID2='" + BranchID + "' and BranchID3='" + BranchID + "' and BranchID4='" + BranchID + "'", Conn); DataSet ds = new DataSet(); da.Fill(ds); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.SPID = ds.Tables[0].Rows[i]["SPID"].ToString(); dbdc.Supplier = ds.Tables[0].Rows[i]["AccountID"].ToString(); dbdc.CurrenctyType = "PKR"; dbdc.Rate = ds.Tables[0].Rows[i]["RMBValue"].ToString(); dbdc.PackingRate = ds.Tables[0].Rows[i]["RMBPackingRate"].ToString(); dbdc.PackingAccount = ds.Tables[0].Rows[i]["PackingID"].ToString(); dbdc.SupplierAmountPKR = ds.Tables[0].Rows[i]["SupplierAmountPKR"].ToString(); dbdc.SupplierAmountRMB = ds.Tables[0].Rows[i]["SupplierAmountRMB"].ToString(); dbdc.PackingAmountPKR = ds.Tables[0].Rows[i]["PackingAmountPKR"].ToString(); dbdc.PackingAmountRMB = ds.Tables[0].Rows[i]["PackingAmountRMB"].ToString(); dbdc.DiscountAmountPKR = ds.Tables[0].Rows[i]["SalesDiscountPKR"].ToString(); dbdc.DiscountAmountRMB = ds.Tables[0].Rows[i]["SalesDiscountRMB"].ToString(); dbdc.TotalAmountPKR = ds.Tables[0].Rows[i]["GrandTotal"].ToString(); dbdc.TotalAmountRMB = ds.Tables[0].Rows[i]["RMBAmount"].ToString(); dbdc.ItemID = ds.Tables[0].Rows[i]["ITEMID"].ToString(); dbdc.Qty = ds.Tables[0].Rows[i]["QtyIn"].ToString(); dbdc.UnitPricePKR = ds.Tables[0].Rows[i]["BasicUnitPricePKR"].ToString(); dbdc.UnitPriceRMB = ds.Tables[0].Rows[i]["BasicUnitPriceRMB"].ToString(); dbdc.PackingRMB = ds.Tables[0].Rows[i]["RMBPackingPrice"].ToString(); dbdc.CostPKR = ds.Tables[0].Rows[i]["UnitPrice"].ToString(); dbdc.CostRMB = ds.Tables[0].Rows[i]["RMBUnitPrice"].ToString(); dbdc.TotalPricePKR = ds.Tables[0].Rows[i]["TotalPrice"].ToString(); dbdc.TOtalPriceRMB = ds.Tables[0].Rows[i]["RMBTotalPrice"].ToString(); dbdc.Remarks = ds.Tables[0].Rows[i]["Remarks"].ToString(); dbdc.SPDate = ds.Tables[0].Rows[i]["SPDate"].ToString(); dbdc.Container = ds.Tables[0].Rows[i]["ContainerNo"].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadRegion() { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); DataSet ds = AACommon.ReturnDatasetBySPWithoutParameter("Customer_Get", Conn); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.CustomerID = ds.Tables[0].Rows[i]["CustomerID"].ToString(); dbdc.CustomerTitle = ds.Tables[0].Rows[i]["CustomerTitle"].ToString(); dbdc.CustomerCode = ds.Tables[0].Rows[i]["CustomerCode"].ToString(); dbdc.Phone = ds.Tables[0].Rows[i]["Phone"].ToString(); dbdc.Fax = ds.Tables[0].Rows[i]["Fax"].ToString(); dbdc.Email = ds.Tables[0].Rows[i]["Email"].ToString(); dbdc.AddressLine1 = ds.Tables[0].Rows[i]["AddressLine1"].ToString(); dbdc.AddressLine2 = ds.Tables[0].Rows[i]["AddressLine2"].ToString(); dbdc.NTN = ds.Tables[0].Rows[i]["NTN"].ToString(); dbdc.GST = ds.Tables[0].Rows[i]["GST"].ToString(); dbdc.SRB = ds.Tables[0].Rows[i]["SRB"].ToString(); dbdc.InvoiceDays = ds.Tables[0].Rows[i]["InvoiceDays"].ToString(); dbdc.AgingDays = ds.Tables[0].Rows[i]["AgingDays"].ToString(); dbdc.OpBal = ds.Tables[0].Rows[i]["OpBal"].ToString(); //CellNo, Phone2, CNIC, BookingDay, DeliveryDay, CustomerTypeID dbdc.CellNo = ds.Tables[0].Rows[i]["CellNo"].ToString(); dbdc.Phone2 = ds.Tables[0].Rows[i]["Phone2"].ToString(); dbdc.CNIC = ds.Tables[0].Rows[i]["CNIC"].ToString(); dbdc.BookingDay = ds.Tables[0].Rows[i]["BookingDay"].ToString(); dbdc.DeliveryDay = ds.Tables[0].Rows[i]["DeliveryDay"].ToString(); dbdc.CustomerTypeID = ds.Tables[0].Rows[i]["CustomerTypeID"].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadRegion() { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); DataSet ds = AACommon.ReturnDatasetBySPWithoutParameter("Supplier_Get", Conn); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.SupplierID = ds.Tables[0].Rows[i]["SupplierID"].ToString(); dbdc.SupplierTitle = ds.Tables[0].Rows[i]["SupplierTitle"].ToString(); dbdc.SupplierCode = ds.Tables[0].Rows[i]["SupplierCode"].ToString(); dbdc.Phone = ds.Tables[0].Rows[i]["Phone"].ToString(); dbdc.Fax = ds.Tables[0].Rows[i]["Fax"].ToString(); dbdc.Email = ds.Tables[0].Rows[i]["Email"].ToString(); dbdc.AddressLine1 = ds.Tables[0].Rows[i]["AddressLine1"].ToString(); dbdc.AddressLine2 = ds.Tables[0].Rows[i]["AddressLine2"].ToString(); dbdc.NTN = ds.Tables[0].Rows[i]["NTN"].ToString(); dbdc.GST = ds.Tables[0].Rows[i]["GST"].ToString(); dbdc.SRB = ds.Tables[0].Rows[i]["SRB"].ToString(); dbdc.OpBal = ds.Tables[0].Rows[i]["OpBal"].ToString(); dbdc.Bank1Title = ds.Tables[0].Rows[i]["Bank1Title"].ToString(); dbdc.Bank1AccountNo = ds.Tables[0].Rows[i]["Bank1AccountNo"].ToString(); dbdc.Bank1BankName = ds.Tables[0].Rows[i]["Bank1BankName"].ToString(); dbdc.Bank2Title = ds.Tables[0].Rows[i]["Bank2Title"].ToString(); dbdc.Bank2AccountNo = ds.Tables[0].Rows[i]["Bank2AccountNo"].ToString(); dbdc.Bank2BankName = ds.Tables[0].Rows[i]["Bank2BankName"].ToString(); dbdc.Bank3Title = ds.Tables[0].Rows[i]["Bank3Title"].ToString(); dbdc.Bank3AccountNo = ds.Tables[0].Rows[i]["Bank3AccountNo"].ToString(); dbdc.Bank3BankName = ds.Tables[0].Rows[i]["Bank3BankName"].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadRegion(string BranchID) { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlDataAdapter da = new SqlDataAdapter("SELECT dbo.Accounts.AccountsID, dbo.Accounts.AccountsTitle, dbo.AccountTypeControl.ControlAccID AS AccountTypeID, dbo.AccountTypeControl.ControlAccTitle AS AccountTypeTitle, dbo.Accounts.Contact, dbo.Accounts.Email, dbo.Accounts.Address, dbo.Accounts.City, dbo.Accounts.Country, dbo.Accounts.Reference, dbo.Accounts.OpDebit, dbo.Accounts.OpCredit,dbo.Accounts.OpDebitRMB,dbo.Accounts.OpCreditRMB,dbo.Accounts.RMBValue FROM dbo.Accounts INNER JOIN dbo.AccountTypeControl ON dbo.Accounts.ControlAccID = dbo.AccountTypeControl.ControlAccID where dbo.AccountTypeControl.BranchID='" + BranchID + "' and dbo.Accounts.BranchID='" + BranchID + "' ", Conn); DataSet ds = new DataSet(); da.Fill(ds); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.ITEMID = ds.Tables[0].Rows[i][0].ToString(); dbdc.ITEMName = ds.Tables[0].Rows[i][1].ToString(); dbdc.ItemCode = ds.Tables[0].Rows[i][2].ToString(); dbdc.BarCode = ds.Tables[0].Rows[i][3].ToString(); dbdc.Contact = ds.Tables[0].Rows[i][4].ToString(); dbdc.Email = ds.Tables[0].Rows[i][5].ToString(); dbdc.Address = ds.Tables[0].Rows[i][6].ToString(); dbdc.City = ds.Tables[0].Rows[i][7].ToString(); dbdc.Country = ds.Tables[0].Rows[i][8].ToString(); dbdc.Reference = ds.Tables[0].Rows[i][9].ToString(); dbdc.OpDebit = ds.Tables[0].Rows[i][10].ToString(); dbdc.OpCredit = ds.Tables[0].Rows[i][11].ToString(); dbdc.OpDebitRMB = ds.Tables[0].Rows[i][12].ToString(); dbdc.OpCreditRMB = ds.Tables[0].Rows[i][13].ToString(); dbdc.RMBValue = ds.Tables[0].Rows[i][14].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string loginUser(string LoginID, string password, string Branch) { password = Encryption.Encrypt(password); SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlParameter UserID = new SqlParameter("@UserID", LoginID); SqlParameter Password = new SqlParameter("@Password", password); SqlParameter BranchID = new SqlParameter("@BranchID", Branch); DataSet ds = AACommon.ReturnDatasetBySP("USER_GET_BY_LOGINID", Conn, UserID, Password, BranchID); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.ID = ds.Tables[0].Rows[i]["UserID"].ToString(); dbdc.Name = ds.Tables[0].Rows[i]["UserName"].ToString(); dbdc.Login = ds.Tables[0].Rows[i]["loginID"].ToString(); dbdc.Picture = ds.Tables[0].Rows[i]["Picture"].ToString(); dbdc.Manager = ds.Tables[0].Rows[i]["ManagerID"].ToString(); dbdc.UTID = ds.Tables[0].Rows[i]["UTID"].ToString(); dbdc.Designation = ds.Tables[0].Rows[i]["UTID"].ToString(); dbdc.BranchID = ds.Tables[0].Rows[i]["BranchID"].ToString(); dbdc.UTDesc = ds.Tables[0].Rows[i]["UTDesc"].ToString(); dbdc.BranchName = ds.Tables[0].Rows[i]["BranchName"].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadRegion(string Category) { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); if (Category == "Brand") { SqlDataAdapter da = new SqlDataAdapter("SELECT dbo.SP_MASTER.SPID, dbo.SP_MASTER.SPDate, dbo.Accounts.AccountsID, dbo.Accounts.AccountsTitle FROM dbo.SP_MASTER INNER JOIN dbo.Accounts ON dbo.SP_MASTER.AccountID = dbo.Accounts.AccountsID", Conn); DataSet ds = new DataSet(); da.Fill(ds); string[][] arr = new string[ds.Tables[0].Rows.Count][]; string[][] arrdetail = new string[3][]; int c = 0; if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { SqlDataAdapter da1 = new SqlDataAdapter("SELECT dbo.Accounts.AccountsID, dbo.Accounts.AccountsTitle, dbo.SP_DETAIL.ITEMID, dbo.SP_DETAIL.QtyIn, dbo.SP_DETAIL.UnitPrice, dbo.SP_MASTER.SPDate FROM dbo.SP_MASTER INNER JOIN dbo.SP_DETAIL ON dbo.SP_MASTER.SPID = dbo.SP_DETAIL.SPID INNER JOIN dbo.Accounts ON dbo.SP_MASTER.AccountID = dbo.Accounts.AccountsID where SP_MASTER.SPID='" + ds.Tables[0].Rows[i]["SPID"].ToString() + "'", Conn); DataTable dt1 = new DataTable(); da1.Fill(dt1); if (dt1.Rows.Count > 0) { arrdetail[c] = new string[dt1.Rows.Count]; for (int k = 0; k < dt1.Rows.Count; k++) { arrdetail[c][k] = dt1.Rows[k]["ITEMID"].ToString(); } c++; } } for (int i = 0; i < arrdetail.Length; i++) { for (int j = 0; j < arrdetail[i].Length; j++) { if (!frequentItems.Contains(arrdetail[i][j])) //aggr arr[i,j] exixts na krta ho list(frequentItems) main tw list main add krdo value arr[i,j] { //if (arr[i][j] != frequentItems[j]) frequentItems.Add(arrdetail[i][j]); } } } } int[] itemsCount = new int[frequentItems.Count]; for (int k = 0; k < frequentItems.Count; k++) { int count = 0; for (int i = 0; i < arrdetail.Length; i++) { for (int j = 0; j < arrdetail[i].Length; j++) { if (frequentItems[k] == arrdetail[i][j]) { count++; } } } itemsCount[k] = count; } int sum = 0; for (int i = 0; i < itemsCount.Length; i++) { sum = sum + itemsCount[i]; } int average = sum / itemsCount.Length; // check sealing or flouring properly in average List <int> itmcountlist = itemsCount.ToList <int>(); // int counter = 0; for (int i = 0; i < itmcountlist.Count; i++) { if (itmcountlist[i] <= average) { //swap(i, itemsCount); frequentItems.RemoveAt(i); itmcountlist.RemoveAt(i); i--; // counter++; } } SqlDataAdapter daexp = new SqlDataAdapter("SELECT dbo.SP_DETAIL.ITEMID, dbo.SP_MASTER.SPDate, dbo.Brand.BrandID, dbo.Brand.BrandTitle FROM dbo.SP_DETAIL INNER JOIN dbo.SP_MASTER ON dbo.SP_DETAIL.SPID = dbo.SP_MASTER.SPID INNER JOIN dbo.ITM_ITEM ON dbo.SP_DETAIL.ITEMID = dbo.ITM_ITEM.ITEMID INNER JOIN dbo.Brand ON dbo.ITM_ITEM.BrandID = dbo.Brand.BrandID WHERE (CONVERT(date, dbo.SP_MASTER.SPDate) <= DATEADD(day, 30, getdate()))", Conn); DataTable dtexp = new DataTable(); daexp.Fill(dtexp); if (dtexp.Rows.Count > 0) { SqlCommand cmdd = new SqlCommand("delete from BrandPackage", Conn); Conn.Open(); cmdd.ExecuteNonQuery(); Conn.Close(); for (int i = 0; i < frequentItems.Count; i++) { SqlDataAdapter daa = new SqlDataAdapter("SELECT dbo.ITM_ITEM.ITEMID, dbo.ITM_ITEM.ITEMName, dbo.Brand.BrandID, dbo.Brand.BrandTitle FROM dbo.ITM_ITEM INNER JOIN dbo.Brand ON dbo.ITM_ITEM.BrandID = dbo.Brand.BrandID WHERE (dbo.ITM_ITEM.ISDELETE = 0) AND dbo.ITM_ITEM.ITEMID='" + frequentItems[i] + "'", Conn); DataTable dtt = new DataTable(); daa.Fill(dtt); if (dtt.Rows.Count > 0) { SqlCommand cmd = new SqlCommand("insert into BrandPackage (ITEMID,ITEMName,BrandID,BrandName) values ('" + dtt.Rows[0]["ITEMID"].ToString() + "','" + dtt.Rows[0]["ITEMName"].ToString() + "','" + dtt.Rows[0]["BrandID"].ToString() + "','" + dtt.Rows[0]["BrandTitle"].ToString() + "')", Conn); Conn.Open(); cmd.ExecuteNonQuery(); Conn.Close(); } } } SqlDataAdapter dafinal = new SqlDataAdapter("select *,'Brand' As Brand from BrandPackage", Conn); DataTable dtfinal = new DataTable(); dafinal.Fill(dtfinal); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (dtfinal.Rows.Count > 0) { for (int i = 0; i < dtfinal.Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.ITEMID = dtfinal.Rows[i][1].ToString(); dbdc.ITEMName = dtfinal.Rows[i][2].ToString(); dbdc.ItemCode = dtfinal.Rows[i][3].ToString(); dbdc.BarCode = dtfinal.Rows[i][4].ToString(); dbdc.Type = dtfinal.Rows[i][5].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); } else { SqlDataAdapter da = new SqlDataAdapter("SELECT dbo.SP_MASTER.SPID, dbo.SP_MASTER.SPDate, dbo.Accounts.AccountsID, dbo.Accounts.AccountsTitle FROM dbo.SP_MASTER INNER JOIN dbo.Accounts ON dbo.SP_MASTER.AccountID = dbo.Accounts.AccountsID", Conn); DataSet ds = new DataSet(); da.Fill(ds); string[][] arr = new string[ds.Tables[0].Rows.Count][]; string[][] arrdetail = new string[3][]; int c = 0; if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { SqlDataAdapter da1 = new SqlDataAdapter("SELECT dbo.Accounts.AccountsID, dbo.Accounts.AccountsTitle, dbo.SP_DETAIL.ITEMID, dbo.SP_DETAIL.QtyIn, dbo.SP_DETAIL.UnitPrice, dbo.SP_MASTER.SPDate FROM dbo.SP_MASTER INNER JOIN dbo.SP_DETAIL ON dbo.SP_MASTER.SPID = dbo.SP_DETAIL.SPID INNER JOIN dbo.Accounts ON dbo.SP_MASTER.AccountID = dbo.Accounts.AccountsID where SP_MASTER.SPID='" + ds.Tables[0].Rows[i]["SPID"].ToString() + "'", Conn); DataTable dt1 = new DataTable(); da1.Fill(dt1); if (dt1.Rows.Count > 0) { arrdetail[c] = new string[dt1.Rows.Count]; for (int k = 0; k < dt1.Rows.Count; k++) { arrdetail[c][k] = dt1.Rows[k]["ITEMID"].ToString(); } c++; } } for (int i = 0; i < arrdetail.Length; i++) { for (int j = 0; j < arrdetail[i].Length; j++) { if (!frequentItems.Contains(arrdetail[i][j])) //aggr arr[i,j] exixts na krta ho list(frequentItems) main tw list main add krdo value arr[i,j] { //if (arr[i][j] != frequentItems[j]) frequentItems.Add(arrdetail[i][j]); } } } } int[] itemsCount = new int[frequentItems.Count]; for (int k = 0; k < frequentItems.Count; k++) { int count = 0; for (int i = 0; i < arrdetail.Length; i++) { for (int j = 0; j < arrdetail[i].Length; j++) { if (frequentItems[k] == arrdetail[i][j]) { count++; } } } itemsCount[k] = count; } int sum = 0; for (int i = 0; i < itemsCount.Length; i++) { sum = sum + itemsCount[i]; } int average = sum / itemsCount.Length; // check sealing or flouring properly in average List <int> itmcountlist = itemsCount.ToList <int>(); // int counter = 0; for (int i = 0; i < itmcountlist.Count; i++) { if (itmcountlist[i] <= average) { //swap(i, itemsCount); frequentItems.RemoveAt(i); itmcountlist.RemoveAt(i); i--; // counter++; } } SqlDataAdapter daexp = new SqlDataAdapter("SELECT dbo.SP_DETAIL.ITEMID, dbo.SP_MASTER.SPDate, dbo.Category.CatID As BrandID, dbo.Category.CatTitle AS BrandTitle FROM dbo.SP_DETAIL INNER JOIN dbo.SP_MASTER ON dbo.SP_DETAIL.SPID = dbo.SP_MASTER.SPID INNER JOIN dbo.ITM_ITEM ON dbo.SP_DETAIL.ITEMID = dbo.ITM_ITEM.ITEMID INNER JOIN dbo.Category ON dbo.ITM_ITEM.CatID = dbo.Category.CatID WHERE (CONVERT(date, dbo.SP_MASTER.SPDate) <= DATEADD(day, 30, getdate()))", Conn); DataTable dtexp = new DataTable(); daexp.Fill(dtexp); if (dtexp.Rows.Count > 0) { SqlCommand cmdd = new SqlCommand("delete from CategoryPackage", Conn); Conn.Open(); cmdd.ExecuteNonQuery(); Conn.Close(); for (int i = 0; i < frequentItems.Count; i++) { SqlDataAdapter daa = new SqlDataAdapter("SELECT dbo.ITM_ITEM.ITEMID, dbo.ITM_ITEM.ITEMName, dbo.Category.CatID, dbo.Category.CatTitle FROM dbo.ITM_ITEM INNER JOIN dbo.Category ON dbo.ITM_ITEM.CatID = dbo.Category.CatID WHERE (dbo.ITM_ITEM.ISDELETE = 0) AND dbo.ITM_ITEM.ITEMID='" + frequentItems[i] + "'", Conn); DataTable dtt = new DataTable(); daa.Fill(dtt); if (dtt.Rows.Count > 0) { SqlCommand cmd = new SqlCommand("insert into CategoryPackage (ITEMID,ITEMName,CatID,CatName) values ('" + dtt.Rows[0]["ITEMID"].ToString() + "','" + dtt.Rows[0]["ITEMName"].ToString() + "','" + dtt.Rows[0]["CatID"].ToString() + "','" + dtt.Rows[0]["CatTitle"].ToString() + "')", Conn); Conn.Open(); cmd.ExecuteNonQuery(); Conn.Close(); } } } SqlDataAdapter dafinal = new SqlDataAdapter("select *,'Category' As Category from CategoryPackage", Conn); DataTable dtfinal = new DataTable(); dafinal.Fill(dtfinal); List <GetRegionClass> RegionList = new List <GetRegionClass>(); RegionList.Clear(); if (dtfinal.Rows.Count > 0) { for (int i = 0; i < dtfinal.Rows.Count; i++) { GetRegionClass dbdc = new GetRegionClass(); dbdc.ITEMID = dtfinal.Rows[i][1].ToString(); dbdc.ITEMName = dtfinal.Rows[i][2].ToString(); dbdc.ItemCode = dtfinal.Rows[i][3].ToString(); dbdc.BarCode = dtfinal.Rows[i][4].ToString(); dbdc.Type = dtfinal.Rows[i][5].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); } }