Пример #1
0
        public void BindCycleCountLocation()
        {
            DataTable         dt          = new DataTable();
            DataSet           ds          = new DataSet();
            iCycleCountClient cycleclient = new iCycleCountClient();
            CustomProfile     profile     = CustomProfile.GetProfile();
            //string Object = "Location";
            string Object = hdnobject.Value;

            string SessionID = Session.SessionID;

            try
            {
                ds = cycleclient.GetCycleCountTempDataByLoc(Object, profile.Personal.UserID, SessionID, profile.DBConnection._constr);
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    txtgridvalues.Text     = "Location";
                    grdlocation.DataSource = ds.Tables[0];
                    grdlocation.DataBind();
                }
                else
                {
                    grdlocation.DataSource = null;
                    grdlocation.DataBind();
                }
            }
            catch { }
            finally { cycleclient.Close(); }
        }
        public void GetCycleCountRecord()
        {
            iCycleCountClient Cycle = new iCycleCountClient();

            try
            {
                if (Request.QueryString["Sequence"] != "" || Request.QueryString["Sequence"] != null || Request.QueryString["Sequence"] != "")
                {
                    da = new SqlDataAdapter("select ProductCode,LocationCode,QtyBalance,ActualQty,AdjustmentQty,Remark,AdjustLocation,DiffQty,BatchCode,SKUID,LocationID from tCycleCountDetail where ID='" + CycleDetailID + "' and CountHeadID=" + CountHeadID + "", con1);
                    da.Fill(ds);
                    dt = ds.Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        txtprodCode.Text   = dt.Rows[0]["ProductCode"].ToString();
                        txtlocCode.Text    = dt.Rows[0]["LocationCode"].ToString();
                        txtsysQty.Text     = dt.Rows[0]["QtyBalance"].ToString();
                        txtActualQty.Text  = dt.Rows[0]["ActualQty"].ToString();
                        txtAdjQty.Text     = dt.Rows[0]["DiffQty"].ToString();
                        txtbatch.Text      = dt.Rows[0]["BatchCode"].ToString();
                        hdnproductId.Value = dt.Rows[0]["SKUID"].ToString();
                        hdndiffQty.Value   = dt.Rows[0]["DiffQty"].ToString();
                        hdnfromlocID.Value = dt.Rows[0]["LocationID"].ToString();
                    }
                }
            }
            catch { }
            finally
            {
                con1.Close();
                Cycle.Close();
            }
        }
Пример #3
0
        public void BindCycleCountProduct()
        {
            DataTable         dt          = new DataTable();
            DataSet           ds          = new DataSet();
            iCycleCountClient cycleclient = new iCycleCountClient();
            CustomProfile     profile     = CustomProfile.GetProfile();
            string            Object      = "Product";

            string SessionID = Session.SessionID;

            try
            {
                //ds = company.GetCostCenterList(long.Parse(hndCompanyid.Value), profile.DBConnection._constr);
                ds = cycleclient.GetCycleCounttempdata(Object, profile.Personal.UserID, SessionID, profile.DBConnection._constr);
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    txtgridvalues.Text       = "Product";
                    grdcyclecount.DataSource = ds.Tables[0];
                    grdcyclecount.DataBind();
                }
                else
                {
                    grdcyclecount.DataSource = null;
                    grdcyclecount.DataBind();
                }
            }
            catch { }
            finally { cycleclient.Close(); }
        }
Пример #4
0
        private static void BulkInsertToDataBase(string Object1, long HeadID, string SessionID)
        {
            DataSet           ds          = new DataSet();
            SqlConnection     conn        = new SqlConnection("");
            iCycleCountClient cycleclient = new iCycleCountClient();

            conn.ConnectionString = ConfigurationManager.ConnectionStrings["elegantcrm7ConnectionString"].ConnectionString;
            conn.Open();
            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                DataTable     dt      = new DataTable();
                ds = cycleclient.GetCycleTempDataToInsert(Object1, profile.Personal.UserID, SessionID, profile.DBConnection._constr);
                dt = ds.Tables[0];
                DataRow row = dt.NewRow();
                dt.Columns.Add("CycleHeadID", typeof(System.Int64));
                dt.Columns["CycleHeadID"].Expression = HeadID.ToString();
                cycleclient.SaveCyclePlanData(dt, profile.DBConnection._constr);
            }
            catch { }
            finally
            {
                cycleclient.Close();
                conn.Close();
            }
        }
Пример #5
0
        public static void SaveCycleProductIds(string selectedIds, string Object, string SessionID)
        {
            iCycleCountClient CycleClient = new iCycleCountClient();

            try
            {
                CustomProfile  profile   = CustomProfile.GetProfile();
                CycleCountTemp cycletemp = new CycleCountTemp();
                cycletemp.Object       = Object.ToString();
                cycletemp.SessionID    = SessionID.ToString();
                cycletemp.CreatedBy    = profile.Personal.UserID;
                cycletemp.CreationDate = DateTime.Now;
                string   ids   = selectedIds.ToString();
                string[] words = ids.Split(',');
                for (int i = 0; i < words.Length; i++)
                {
                    // long ProductID = long.Parse(words[i]);
                    cycletemp.ReferenceID = long.Parse(words[i]);
                    CycleClient.SaveCycleCounttemp(cycletemp, profile.DBConnection._constr);
                }
            }
            catch (Exception ex)
            {
                //Login.Profile.ErrorHandling(ex, this, "CycleSkuSearch", "SaveCycleProductIds");
            }
            finally
            {
                CycleClient.Close();
            }
        }
Пример #6
0
        public void DeleteCycleTempData(string SessionID)
        {
            iCycleCountClient cycleclient = new iCycleCountClient();
            CustomProfile     profile     = CustomProfile.GetProfile();

            cycleclient.DeleteCycleTempWithoutObj(profile.Personal.UserID, SessionID, profile.DBConnection._constr);
            cycleclient.Close();
        }
Пример #7
0
        protected void GetCyleCountHeadByID(long CycleheadID)
        {
            iCycleCountClient cycle     = new iCycleCountClient();
            CustomProfile     profile   = CustomProfile.GetProfile();
            tCycleCountHead   Cyclehead = new tCycleCountHead();

            Cyclehead = cycle.GetCyleCountHeadByID(CycleheadID, profile.DBConnection._constr);
            if (Cyclehead.Title != null)
            {
                txtTitle.Text = Cyclehead.Title.ToString();
            }
            FillWarehouse();
            if (Cyclehead.WarehouseID != null)
            {
                ddlWarehouse.SelectedIndex = ddlWarehouse.Items.IndexOf(ddlWarehouse.Items.FindByValue(Cyclehead.WarehouseID.ToString()));
            }
            hdnwarehouseId.Value = Cyclehead.WarehouseID.ToString();
            if (Cyclehead.CycleCountDate != null)
            {
                UC_FromDate.Date = Cyclehead.CycleCountDate;
            }
            if (Cyclehead.Exicutive != null)
            {
                txtexicutive.Text = Cyclehead.Exicutive.ToString();
            }
            if (Cyclehead.Status != null)
            {
                ddlstatus.SelectedIndex = ddlstatus.Items.IndexOf(ddlstatus.Items.FindByText(Cyclehead.Status.ToString()));
            }
            if (Cyclehead.CountBasis != null)
            {
                ddlcountbasis.SelectedIndex = ddlcountbasis.Items.IndexOf(ddlcountbasis.Items.FindByText(Cyclehead.CountBasis.ToString()));
            }
            if (Cyclehead.Frequency != null)
            {
                hdnfrequency.Value = Cyclehead.Frequency.ToString();
            }
            if (Cyclehead.Active == "Yes")
            {
                rbtnActiveYes.Checked = true;
                rbtnActiveNo.Checked  = false;
            }
            else
            {
                rbtnActiveYes.Checked = false;
                rbtnActiveNo.Checked  = true;
            }
        }
Пример #8
0
        public static List <contact> GetBatchCodeBySKU(object objReq)
        {
            iCycleCountClient cycle   = new iCycleCountClient();
            CustomProfile     profile = CustomProfile.GetProfile();
            DataSet           ds      = new DataSet();
            DataTable         dt      = new DataTable();
            List <contact>    LocList = new List <contact>();

            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary = (Dictionary <string, object>)objReq;

                long WarehouseID = long.Parse(dictionary["WarehouseID"].ToString());
                long SKUID       = long.Parse(dictionary["SKUID"].ToString());
                long locationID  = long.Parse(dictionary["locationID"].ToString());

                //ds = StatutoryClient.GetCustomerList(ddlcompanyId, profile.DBConnection._constr);
                ds = cycle.GetBatchCodeBySKU(SKUID, locationID, profile.DBConnection._constr);
                dt = ds.Tables[0];
                contact Loc = new contact();
                Loc.Name = "--Select--";
                Loc.Id   = "0";
                LocList.Add(Loc);
                Loc = new contact();
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Loc.Id   = dt.Rows[i]["ID"].ToString();
                        Loc.Name = dt.Rows[i]["BatchCode"].ToString();
                        LocList.Add(Loc);
                        Loc = new contact();
                    }
                }
            }
            catch
            {
            }
            finally
            {
                cycle.Close();
            }
            return(LocList);
        }
Пример #9
0
        public void BindCycleMainGrid()
        {
            iCycleCountClient cycle = new iCycleCountClient();

            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                grdcyclecount.DataSource = cycle.GetCycleCountMain(profile.DBConnection._constr);                                             //GetCycleCountMain(profile.DBConnection._constr);
                grdcyclecount.DataBind();
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, this, "Warehouse Master", "MainCustomerGridBind");
            }
            finally
            {
                cycle.Close();
            }
        }
Пример #10
0
        public static string CheckSKUInPlan(string SKUCode, string CycleHeadID, string WarehouseID, string Object, string locationID)
        {
            string            result = "";
            string            SKU    = "";
            long              Count;
            long              SKUId   = 0;
            iCycleCountClient cycle   = new iCycleCountClient();
            CustomProfile     profile = CustomProfile.GetProfile();

            try
            {
                SKUId = cycle.GetSKUIDBySKUCode(SKUCode.Trim(), long.Parse(WarehouseID), profile.DBConnection._constr);
                SKU   = SKUId.ToString();
                if (SKUId != 0)
                {
                    Count = cycle.CheckLocInPlann(Object, long.Parse(CycleHeadID), SKUId, profile.DBConnection._constr);

                    if (Count <= 0)
                    {
                        result = "Not In Plan";
                    }
                }

                else
                {
                    result = "SKU Not Found";
                }

                result = result + "-" + SKU;
            }
            catch { }
            finally
            {
                cycle.Close();
            }

            return(result);
        }
Пример #11
0
        public static string CheckLocInPlan(string LocationCode, string CycleHeadID, string WarehouseID, string Object)
        {
            string            result   = "";
            string            Location = "";
            long              Count;
            long              LocationID = 0;
            iCycleCountClient cycle      = new iCycleCountClient();
            CustomProfile     profile    = CustomProfile.GetProfile();

            try
            {
                LocationID = cycle.GetLocationID(LocationCode.Trim(), long.Parse(WarehouseID), profile.DBConnection._constr);
                Location   = LocationID.ToString();
                if (LocationID != 0)
                {
                    Count = cycle.CheckLocInPlann(Object, long.Parse(CycleHeadID), LocationID, profile.DBConnection._constr);

                    if (Count <= 0)
                    {
                        result = "Not In Plan";
                    }
                }

                else
                {
                    result = "Location Not Found";
                }

                result = result + "-" + Location;
            }
            catch { }
            finally
            {
                cycle.Close();
            }

            return(result);
        }
Пример #12
0
        protected void pageSave(Object sender, BrilliantWMS.ToolbarService.iUCToolbarClient e)
        {
            CustomProfile     profile     = CustomProfile.GetProfile();
            iCycleCountClient cycleclient = new iCycleCountClient();
            tCycleCountHead   cycleH      = new tCycleCountHead();
            DataSet           ds          = new DataSet();

            if (hdnCycleheadID.Value != "")
            {
                cycleH.ID             = long.Parse(hdnCycleheadID.Value);
                cycleH.Title          = txtTitle.Text.ToString();
                cycleH.Status         = ddlstatus.SelectedItem.Text;
                cycleH.CountBasis     = ddlcountbasis.SelectedItem.Text;
                cycleH.CycleCountDate = UC_FromDate.Date;
                cycleH.WarehouseID    = long.Parse(hdnwarehouseId.Value);
                cycleH.Frequency      = hdnfrequency.Value;
                cycleH.CreatedBy      = profile.Personal.UserID;
                cycleH.CreationDate   = DateTime.Now;
                cycleH.Active         = "Yes";
                if (rbtnActiveNo.Checked == true)
                {
                    cycleH.Active = "No";
                }

                ds = cycleclient.getCompanyCustomer(long.Parse(hdnwarehouseId.Value), profile.DBConnection._constr);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    cycleH.CompanyID  = long.Parse(ds.Tables[0].Rows[0]["CompanyID"].ToString());
                    cycleH.CustomerID = long.Parse(ds.Tables[0].Rows[0]["CustomerID"].ToString());
                }

                long CycleHeadID = cycleclient.SaveCycleCountHead(cycleH, profile.DBConnection._constr);
                WebMsgBox.MsgBox.Show("Record saved successfully");
                clear();
                BindCycleMainGrid();
                Response.Redirect("CycleCount.aspx");
            }
        }
Пример #13
0
        public static string PMSaveWLocation(object Plans)
        {
            string            result = "";
            CustomProfile     profile = CustomProfile.GetProfile();
            iCycleCountClient cycleclient = new iCycleCountClient();
            tCycleCountHead   cycleH = new tCycleCountHead();
            string            ContBasis = "", SessionID = "";

            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary = (Dictionary <string, object>)Plans;

                cycleH.Title       = dictionary["Title"].ToString();
                cycleH.WarehouseID = long.Parse(dictionary["WarehouseID"].ToString());
                cycleH.Status      = dictionary["Status"].ToString();
                cycleH.Frequency   = dictionary["Frequency"].ToString();
                string Frequency = dictionary["Frequency"].ToString();
                cycleH.CountBasis = dictionary["CountBasis"].ToString();
                cycleH.Active     = "Yes";
                ContBasis         = dictionary["CountBasis"].ToString();
                SessionID         = dictionary["session"].ToString();

                DateTime FromDate  = DateTime.Parse(dictionary["FromDate"].ToString());
                DateTime ToDate    = DateTime.Parse(dictionary["ToDate"].ToString());
                TimeSpan days      = ToDate - FromDate;
                long     DaysNo    = long.Parse(days.TotalDays.ToString());
                long     totaldays = 0;
                int      i         = 0;
                int      j         = 0;
                int      ival;
                if (Frequency == "Daily")
                {
                    if (DaysNo >= 12)
                    {
                        result = "More Than Daily";
                    }
                    else
                    {
                        totaldays = DaysNo;
                    }
                }
                else if (Frequency == "Weekly")
                {
                    if (DaysNo >= 84)
                    {
                        result = "More Than Weekly";
                    }
                    else
                    {
                        double dayst = DaysNo / 7;
                        totaldays = long.Parse(Math.Round(dayst).ToString());
                    }
                }
                else if (Frequency == "Monthly")
                {
                    if (DaysNo >= 365)
                    {
                        result = "More Than Monthly";
                    }
                    else
                    {
                        double dayst = DaysNo / 30;
                    }
                }
                else if (Frequency == "Quarterly")
                {
                    if (DaysNo >= 1080)
                    {
                        result = "More Than Quarterly";
                    }
                    else
                    {
                        double dayst = DaysNo / 90;
                        totaldays = long.Parse(Math.Round(dayst).ToString());
                    }
                }

                if (result == "")
                {
                    for (i = 0; i <= totaldays; i++)
                    {
                        cycleH.CycleCountDate = FromDate.AddDays(j);
                        long CycleHeadID = cycleclient.SaveCycleCountHead(cycleH, profile.DBConnection._constr);
                        BulkInsertToDataBase(ContBasis, CycleHeadID, SessionID);

                        if (Frequency == "Daily")
                        {
                            j = j + 1;
                        }
                        else if (Frequency == "Weekly")
                        {
                            j = j + 7;
                        }
                        else if (Frequency == "Monthly")
                        {
                            j = j + 30;
                        }
                        else if (Frequency == "Quarterly")
                        {
                            j = j + 90;
                        }
                    }
                    result = "Cycle saved successfully";
                    DeleteFromCycleTempData(ContBasis, SessionID);
                }
            }
            catch
            {
                result = "Some error occurred";
                DeleteFromCycleTempData(ContBasis, SessionID);
            }
            finally
            {
                cycleclient.Close();
            }

            return(result);
        }
Пример #14
0
        public static string PMSaveCycleCount(object cyclecount)
        {
            string            result = "";
            CustomProfile     profile = CustomProfile.GetProfile();
            iCycleCountClient cycleclient = new iCycleCountClient();
            tCycleCountDetail cycledetail = new tCycleCountDetail();
            DataSet           ds = new DataSet();
            string            ContBasis = "", SessionID = "";
            decimal           DiffQuantity = 0;
            long LocationID = 0, SKUID = 0;

            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary = (Dictionary <string, object>)cyclecount;

                cycledetail.CountHeadID = long.Parse(dictionary["CycleheadID"].ToString());
                long CycleHeadId = long.Parse(dictionary["CycleheadID"].ToString());
                SKUID      = long.Parse(dictionary["hdnProductID"].ToString());
                LocationID = long.Parse(dictionary["locationID"].ToString());
                string  SKUCode      = dictionary["txtproduct"].ToString();
                string  LocationCode = dictionary["txtlocationCode"].ToString();
                long    WarehouseID  = long.Parse(dictionary["WarehouseID"].ToString());
                decimal Quantity     = decimal.Parse(dictionary["Quantity"].ToString());
                cycledetail.BatchCode = dictionary["BatchCode"].ToString();
                string BatchCode = dictionary["BatchCode"].ToString();
                if (LocationID == 0 || LocationID == null)
                {
                    LocationID = cycleclient.GetLocationID(LocationCode.Trim(), WarehouseID, profile.DBConnection._constr);
                }
                if (SKUID == 0 || SKUID == null)
                {
                    SKUID = cycleclient.GetSKUID(SKUCode.Trim(), WarehouseID, profile.DBConnection._constr);
                }
                cycledetail.ProductCode  = SKUCode;
                cycledetail.LocationCode = LocationCode;
                cycledetail.SKUID        = SKUID;
                cycledetail.LocationID   = LocationID;
                cycledetail.CreatedBy    = profile.Personal.UserID.ToString();
                cycledetail.CreationDate = DateTime.Now;


                decimal SystemQty = cycleclient.GetSystemQtyByBatch(SKUID, LocationID, BatchCode, profile.DBConnection._constr);
                cycledetail.QtyBalance = SystemQty;

                ds = cycleclient.GetRepeatedCycleCountData(CycleHeadId, SKUID, LocationID, BatchCode, profile.DBConnection._constr);
                if (ds.Tables[0].Rows.Count == 0)
                {
                    DiffQuantity          = SystemQty - Quantity;
                    cycledetail.ActualQty = Quantity;
                    cycledetail.DiffQty   = DiffQuantity;
                    long CycleDetailID = cycleclient.SaveCycleCount(cycledetail, profile.DBConnection._constr);
                }
                else
                {
                    long    DetailID  = long.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                    decimal ActualQty = decimal.Parse(ds.Tables[0].Rows[0]["ActualQty"].ToString());
                    decimal DiffQty   = decimal.Parse(ds.Tables[0].Rows[0]["DiffQty"].ToString());
                    cycledetail.ActualQty = Quantity + ActualQty;
                    cycledetail.ID        = DetailID;
                    DiffQuantity          = DiffQty - Quantity;
                    cycledetail.DiffQty   = DiffQuantity;
                    long CycleDetailID = cycleclient.SaveCycleCount(cycledetail, profile.DBConnection._constr);
                }
            }
            catch
            {
                result = "Some error occurred";
            }
            finally
            {
            }

            return(result);
        }
        public static string GetlocationQty(object objReq)
        {
            iCycleCountClient Cycle   = new iCycleCountClient();
            CustomProfile     profile = CustomProfile.GetProfile();
            tCycleCountDetail Dcycle  = new tCycleCountDetail();
            string            result  = "";

            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary = (Dictionary <string, object>)objReq;

                string  ProductCode   = dictionary["ProductCode"].ToString();
                string  locationcode  = dictionary["Location"].ToString();
                long    ProductID     = long.Parse(dictionary["ProductID"].ToString());
                long    LocationID    = long.Parse(dictionary["FromLocID"].ToString());
                string  BatchCode     = dictionary["BatchCode"].ToString();
                decimal SystemQty     = decimal.Parse(dictionary["SystemQty"].ToString());
                decimal ActualQty     = decimal.Parse(dictionary["ActualQty"].ToString());
                decimal AjustmentQty  = decimal.Parse(dictionary["AjustmentQty"].ToString());
                string  Remark        = dictionary["Remark"].ToString();
                string  AdjustLoc     = dictionary["AdjustmentLocIds"].ToString();
                long    CycleHeadID   = long.Parse(dictionary["CycleHeadID"].ToString());
                long    CycleDetailID = long.Parse(dictionary["CycleDetailID"].ToString());

                string[] ToLocIds     = AdjustLoc.Split(',');
                decimal  calculateQty = AjustmentQty;



                Cycle.UpdateStockSkuTransForFromLoc(ProductID, BatchCode, LocationID, AjustmentQty, profile.DBConnection._constr);

                for (int i = 0; i < ToLocIds.Length; i++)
                {
                    long    ToLocID  = long.Parse(ToLocIds[i].ToString());
                    decimal availQty = Cycle.getLocationRemainingQty(ToLocID, profile.DBConnection._constr);       // need to craete sp add in domain ninterface and build
                    if (calculateQty > availQty)
                    {
                        calculateQty = calculateQty - availQty;
                        Cycle.UpdateStocktransToLoc(ProductID, BatchCode, calculateQty, ToLocID, profile.Personal.UserID, CycleHeadID, profile.DBConnection._constr);    // need to Add CompanyID,CustomerID and UserID
                    }
                    else
                    {
                        Cycle.UpdateStocktransToLoc(ProductID, BatchCode, calculateQty, ToLocID, profile.Personal.UserID, CycleHeadID, profile.DBConnection._constr);     // need to Add CompanyID,CustomerID and UserID
                        calculateQty = 0;
                    }
                }

                Dcycle.ID             = CycleDetailID;
                Dcycle.CountHeadID    = CycleHeadID;
                Dcycle.QtyBalance     = SystemQty;
                Dcycle.ActualQty      = ActualQty;
                Dcycle.DiffQty        = AjustmentQty;
                Dcycle.AdjustmentQty  = AjustmentQty;
                Dcycle.Remark         = Remark;
                Dcycle.AdjustLocation = AdjustLoc;
                Dcycle.ProductCode    = ProductCode;
                Dcycle.LocationCode   = locationcode;
                Dcycle.SKUID          = ProductID;
                Dcycle.LocationID     = LocationID;
                Dcycle.BatchCode      = BatchCode;
                Dcycle.CreatedBy      = profile.Personal.UserID.ToString();
                Dcycle.CreationDate   = DateTime.Now;
                long CycleDtailID = Cycle.SaveCycleCount(Dcycle, profile.DBConnection._constr);



                /*decimal ClosingBalOutProd = Cycle.GetClosingBalance(Parameter, AjustmentQty, ProductID, LocationID);
                 * decimal ClosingBalInProd = Cycle.GetClosingBalance(param, AjustmentQty, ProductID, AdjustLoc);
                 * decimal AdjustmentSUMOut = Cycle.GetAdjustmentSUM(AjustmentQty, ProductID, LocationID);
                 * decimal AdjustmentSUMIN = Cycle.GetAdjustmentSUM(AjustmentQty, ProductID, AdjustLoc);*/

                // Cycle.UpdateCycleCountDetail(AjustmentQty, Remark, CreatedBy, DateTime.Now.Date, ProductCode, CycleHeadID, AdjstmentLoc);
                // // write method for transaction Entries One for out product and one for In product
                // Cycle.InsertTransactionAdjustment("Cycle Count", CycleHeadID, ProductID, LocationID, AdjustLoc, Remark, CreatedBy, DateTime.Now.Date, DateTime.Now.Date, AjustmentQty);

                // // update tinventry AdjustmentQty & QtyBalance for Out transaction
                // Cycle.UpdateInventryForOut(AdjustmentSUMOut, ClosingBalOutProd, ProductID, LocationID);


                // if records of ClosingBalIn product Is not inserted then we have to insert that and if present then update that

                /*   long CheckEntry = Cycle.GetCountTOCheckEntryInInventry(AdjustLoc, ProductID);
                 * if (CheckEntry > 0)
                 * {
                 *     Cycle.UpdateInventryForOut(AdjustmentSUMIN, ClosingBalInProd, ProductID, AdjustLoc);
                 * }
                 * else
                 * {
                 *     Cycle.InsertInventryCycleCount(ProductID, AdjustLoc, "Secondary", AjustmentQty, AjustmentQty, AjustmentQty, CreatedBy, DateTime.Now.Date, "Inventory_Inventory");
                 * }*/


                result = "Adjustment successful";
            }
            catch { result = "Some error occurred"; }
            finally
            {
                Cycle.Close();
            }
            return(result);
        }
Пример #16
0
        public void ProcessRequest(HttpContext context)
        {
            CustomProfile     profile     = CustomProfile.GetProfile();
            iCycleCountClient cycleclient = new iCycleCountClient();
            tCycleCountDetail cycledetail = new tCycleCountDetail();

            SqlConnection conn = new SqlConnection(strcon);

            long   wid = long.Parse(context.Request.Form["wid"]);
            long   uid = long.Parse(context.Request.Form["uid"]);
            long   cyclecountid = long.Parse(context.Request.Form["cid"]);
            string locationcode = "";
            long   locid = 0;
            string prdomsskucode = ""; decimal skuqty = 0;
            //long locid = GetLocationID(locationcode);  //LocationID

            String cycleCountDetails = context.Request.Form["cycleCountDetails"];
            //string myquerystring = "select * from  SplitString('" + cycleCountDetails + "',':')";
            //string myquerystring = "select * from  SplitString('" + cycleCountDetails + "','@')";

            string myquerystring = "select * from  SplitString('" + cycleCountDetails + "',':')";

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = myquerystring;
            cmd.Connection  = conn;
            cmd.Parameters.Clear();
            da.SelectCommand = cmd;
            da.Fill(ds, "tbl1");
            dt = ds.Tables[0];
            int  cntr  = dt.Rows.Count;
            long mySeq = 0;

            if (cntr > 0)
            {
                for (int i = 0; i <= cntr - 1; i++)
                {
                    locationcode  = ds.Tables[0].Rows[i]["part"].ToString();
                    locid         = GetLocationID(ds.Tables[0].Rows[i]["part"].ToString());
                    i             = i + 1;
                    prdomsskucode = ds.Tables[0].Rows[i]["part"].ToString();
                    i             = i + 1;
                    skuqty        = Convert.ToDecimal(ds.Tables[0].Rows[i]["part"].ToString());

                    SqlCommand     cmd1         = new SqlCommand();
                    SqlDataAdapter da1          = new SqlDataAdapter();
                    DataSet        ds1          = new DataSet();
                    DataTable      dt1          = new DataTable();
                    string         dsprdDetails = "select ID,ProductCode,Name , Description  from mProduct where OMSSKUCode=ltrim(rtrim('" + prdomsskucode + "'))";
                    cmd1.CommandType = CommandType.Text;
                    cmd1.CommandText = dsprdDetails;
                    cmd1.Connection  = conn;
                    cmd1.Parameters.Clear();
                    da1.SelectCommand = cmd1;
                    da1.Fill(ds1, "tbl2");
                    dt1 = ds1.Tables[0];

                    string productCode = "";
                    long   prdID       = 0;
                    if (dt1.Rows.Count > 0)
                    {
                        productCode = ds1.Tables[0].Rows[0]["ProductCode"].ToString();
                        prdID       = long.Parse(ds1.Tables[0].Rows[0]["ID"].ToString());
                    }

                    SqlCommand     cmd3 = new SqlCommand();
                    SqlDataAdapter da3  = new SqlDataAdapter();
                    DataSet        ds3  = new DataSet();
                    DataTable      dt3  = new DataTable();

                    string insPrdDetails = "insert into tCycleCountDetail(CountHeadID,ProductCode, LocationCode,ActualQty,CreatedBy, CreationDate,SKUID,LocationID) values(" + cyclecountid + ",'" + productCode + "','" + locationcode + "'," + skuqty + "," + uid + ",'" + DateTime.Now + "'," + prdID + "," + locid + ")";
                    cmd3.CommandType = CommandType.Text;
                    cmd3.CommandText = insPrdDetails;
                    cmd3.Connection  = conn;
                    cmd3.Parameters.Clear();
                    da3.SelectCommand = cmd3;
                    da3.Fill(ds3, "tbl3");

                    mySeq = mySeq + 1;
                }
            }
            String xmlString = String.Empty;

            context.Response.ContentType = "text/plain";
            String jsonString = String.Empty;

            jsonString = "{\n\"resultlist\": [\n";   /*json Loop Start*/
            if (mySeq > 0)
            {
                jsonString = jsonString + "{\n\"status\":\"success\"\n}\n";
            }
            else
            {
                jsonString = jsonString + "{\n\"status\":\"failed\"\n}\n";
            }

            jsonString = jsonString + "]\n}";  /*json Loop End*/
            context.Response.Write(jsonString);
        }