Ejemplo n.º 1
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");
            }
        }
Ejemplo n.º 2
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);
        }