Esempio n. 1
0
 protected void btnUp_Update_Click(object sender, EventArgs e)
 {
     try
     {
         ProductsEntity pe = new ProductsEntity();
         pe.productid    = Convert.ToInt32(ddlUpProducts.SelectedValue);
         pe.categorycode = Convert.ToInt32(ddlUpCategory.SelectedValue);
         pe.formatno     = Convert.ToInt32(ddlUpFormats.SelectedValue);
         pe.LastUserID   = Convert.ToInt32(Session["UserID"]);
         pe.copyproduct  = hdnUpdate.Value.ToString();
         int result = st_dll.UpdateLabelFormat(pe);
         if (result == 1)
         {
             SucessMessage("Format label updated successfully.");
             BindGrid();
         }
         else
         {
             ErrorMessage("Error while updating.");
         }
     }
     catch (Exception ex)
     {
         ErrorMessage("Update error " + ex.Message);
     }
 }
Esempio n. 2
0
 protected void btnCopy_Save_Click(object sender, EventArgs e)
 {
     try
     {
         ProductsEntity pe   = new ProductsEntity();
         string         item = hdncopyitem.Value.ToString();
         if (item != "")
         {
             pe.productid = Convert.ToInt32(ddlCopyProducts.SelectedValue);
             //pe.categorycode = Convert.ToInt32(item.Split('-')[1]);
             //pe.formatno = Convert.ToInt32(item.Split('-')[2]);
             pe.CreatedBy   = Convert.ToInt32(Session["UserID"]);
             pe.copyproduct = item;
             int result = st_dll.CopyLabelFormat(pe);
             if (result == 1)
             {
                 SucessMessage("Format label copied successfully.");
                 BindGrid();
             }
             else
             {
                 ErrorMessage("Error while copying.");
             }
         }
         else
         {
             ErrorMessage("Error while copying.");
         }
     }
     catch (Exception ex)
     {
         ErrorMessage("Copy error " + ex.Message);
     }
 }
Esempio n. 3
0
        protected void btnAddSave_Click(object sender, EventArgs e)
        {
            try
            {
                ProductsEntity pe = new ProductsEntity();
                pe.productid    = Convert.ToInt32(ddlAddProducts.SelectedValue);
                pe.categorycode = Convert.ToInt32(ddlAddCategory.SelectedValue);
                pe.formatno     = Convert.ToInt32(ddlAddFormats.SelectedValue);
                pe.CreatedBy    = Convert.ToInt32(Session["UserID"]);
                int result = st_dll.InsertLabelFormat(pe);

                if (result == 1)
                {
                    SucessMessage("Format label added successfully.");
                    BindGrid();
                    // AddBartenderFileToFolder(pe);
                }
                else
                {
                    ErrorMessage("Error in adding the format label.");
                }
            }
            catch (Exception ex)
            {
                ErrorMessage("Adding error " + ex.Message);
            }
        }
Esempio n. 4
0
        public void voidLabels()
        {
            List <VoidDetails> myList = (List <VoidDetails>)Session["myList"];

            try
            {
                if (myList.Count > 0)
                {
                    ProductsEntity pe;
                    foreach (VoidDetails lst in myList)
                    {
                        pe              = new ProductsEntity();
                        pe.ControlID    = Convert.ToInt32(lst.clabelno.Split('-')[0]);
                        pe.LabelNo      = Convert.ToInt32(lst.clabelno.Split('-')[2].TrimStart('0'));
                        pe.StatusReason = Convert.ToInt32(lst.status);
                        pe.VoidedByID   = Convert.ToInt32(Context.Session["UserID"]);
                        pe.categorycode = Convert.ToInt32(lst.clabelno.Split('-')[1]);
                        pe.batchid      = batchid;
                        int result = st_dll.SaveVoideddata(pe);
                    }
                    Session["myList"] = null;
                    BindGrid();
                    SucessMessage("Total " + myList.Count + " labels are voided successfully.");
                }
                else
                {
                    ErrorMessage("Please scan the lables to void.");
                }
            }
            catch (Exception)
            {
                ErrorMessage("Error in voiding the label.");
            }
        }
Esempio n. 5
0
        protected void btnInsertGenerate_Click(object sender, EventArgs e)
        {
            GridColumns();
            ProductsEntity pe        = new ProductsEntity();
            int            controlid = Convert.ToInt32(hdnControlid.Value);

            //int labelcount = st_dll.GetLabelCount(controlid);
            //Save the No.Of Products in ProdcutCount Table
            st_dll.SaveProductCount(controlid, 2, Convert.ToInt32(txtInsertProduct.Text));
            int labelcount = Convert.ToInt32(txtInsertProduct.Text);

            pe.ControlID    = controlid;
            pe.categorycode = 2;
            DataTable dt = st_dll.GetDBData("dbo.spGenerateLabels", "S", pe);

            if (dt.Rows.Count == 0)
            {
                GenerateLables(controlid, labelcount, 2);
                int unitsize = st_dll.GetUnitSize(controlid);
                if (unitsize != 0)
                {
                    st_dll.InsertIntoCaseSize(controlid, 2);
                }

                GenerateCaseLabels(labelcount);
            }

            Response.Redirect("Printing.aspx?ctrid=" + controlid.ToString() + "&lc=" + labelcount.ToString() + "&cc=2", false);
        }
Esempio n. 6
0
        public int DeleteUserLog(string data)
        {
            ProductsEntity pe     = new ProductsEntity();
            int            userid = Convert.ToInt32(data);
            int            result = us_dll.UpdateUserLog(userid);

            return(result);
        }
Esempio n. 7
0
        public int CheckGeneratedBatch(string data)
        {
            ProductsEntity pe      = new ProductsEntity();
            int            batchid = Convert.ToInt32(data);
            int            result  = gpls.CheckGeneratedBatch(batchid);

            return(result);
        }
Esempio n. 8
0
        private int UpdateProductLabel()
        {
            try
            {
                if (Page.IsValid)
                {
                    try
                    {
                        //int username = 450;
                        ProductsEntity pe = new ProductsEntity();
                        if (hdnControlID.Value != null)
                        {
                            //SqlCommand cmd = new SqlCommand("dbo.stProductsLabeling", conn);
                            //cmd.CommandType = CommandType.StoredProcedure;
                            //cmd.Parameters.AddWithValue("@ManufacturingDate", txtManufacturingDate.Text);
                            //cmd.Parameters.AddWithValue("@Type", "U");
                            //cmd.Parameters.AddWithValue("@ExpirationDate", txtExpirationDate.Text);
                            //cmd.Parameters.AddWithValue("@ProductID", Convert.ToInt32(ddproducts.SelectedItem.Value));
                            //cmd.Parameters.AddWithValue("@LotNo", txtlotno.Text);
                            //cmd.Parameters.AddWithValue("@LabelCount", txtNoLables.Text);
                            //cmd.Parameters.AddWithValue("@ControlID", ViewState["ControlID"]);

                            ////cmd.Parameters.AddWithValue("@ApprovedByID", username);
                            ////cmd.Parameters.AddWithValue("@Reconciled", username);
                            ////cmd.Parameters.AddWithValue("@LastUserID", username);


                            pe.ManufacturingDate = Convert.ToDateTime(txtManufacturingDate.Text + " " + DateTime.Now.ToString("HH:mm:ss tt"));
                            pe.ExpirationDate    = Convert.ToDateTime(txtExpirationDate.Text + " " + DateTime.Now.ToString("HH:mm:ss tt"));
                            pe.productid         = Convert.ToInt32(ddproducts.SelectedItem.Value);
                            pe.LotNo             = txtlotno.Text;
                            pe.labelCount        = Convert.ToInt32(txtNoLables.Text);
                            pe.LastUserID        = Convert.ToInt32(Session["UserID"]);
                            pe.ControlID         = Convert.ToInt32(hdnControlID.Value);
                            pe.PONo = hdnPONo.Value.ToString();
                        }
                        return(st_dll.UpdateProductLabelDetails("dbo.stProductsLabeling", "U", pe));
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                else
                {
                    ErrorMessage("Please fill the required fields details!");
                    return(0);
                }
            }
            catch (Exception ex)
            {
                ErrorMessage(ex.Message);
                return(0);
            }
        }
Esempio n. 9
0
        protected void btnPrintLabels_Click(object sender, EventArgs e)
        {
            try
            {
                ProductsEntity pe = new ProductsEntity();
                pe.formatname   = hdnLabelFormatName.Value.ToString();
                pe.ControlID    = Convert.ToInt32(hdnCheckedControlid.Value);
                pe.categorycode = Convert.ToInt32(hdnCheckedCategoryCode.Value);
                pe.labelCount   = Convert.ToInt32(txtTotalLabelsremaningtoprint.Text);
                pe.batchid      = Convert.ToInt32(hdnCheckedBatchID.Value);
                pe.PrintedByID  = Convert.ToInt32(Session["UserID"]);


                if (pe.formatname != "")
                {
                    ///int result = 1;// BarTenderPrintingLable(pe.ControlID, pe.labelCount, pe.categorycode, pe.formatname, pe.batchid);
                    int result = 0;

                    if (BarTenderStatus == "1")
                    {
                        result = BarTenderPrintingLable(pe.ControlID, pe.labelCount, pe.categorycode, pe.formatname, pe.batchid, 0);
                    }
                    else
                    {
                        result = 1;
                    }
                    if (result == 1)
                    {
                        int updateprint_result = st_dll.UpdatePrinting("dbo.spUpdateInsertBoxPrinting", pe);
                        if (updateprint_result == 1)
                        {
                            SucessMessage("The " + pe.labelCount + " labels are printed successfully.");
                            GetInsertBoxLabelDetails();
                        }
                        else
                        {
                            ErrorMessage("Error in updating print status.");
                        }
                    }
                    else
                    {
                        ErrorMessage("Error in Bartender.");
                    }
                }
                else
                {
                    ErrorMessage("Unable to print.Error in getting filename.");
                }
            }
            catch (Exception ex)
            {
                ErrorMessage("Printing error " + ex.Message);
            }
        }
Esempio n. 10
0
        protected void btnPrintBatch_Click(object sender, EventArgs e)
        {
            try
            {
                ProductsEntity pe = new ProductsEntity();
                pe.ControlID = Convert.ToInt32(hdnControlid.Value);
                //dbo.spProductLabelPrintBatchDetai\s
                DataTable dt = st_dll.GetDBData("dbo.spProductLabelPrintBatchDetails", "S", pe);

                //XElement xelm = (XElement)dt.Rows[0]["PrintBatches"];
                string xmlelm     = dt.Rows[0]["PrintBatches"].ToString();
                string approvedby = dt.Rows[0]["ApprovedByID"].ToString();
                if (approvedby != "")
                {
                    if (xmlelm == "")
                    {
                        XElement Batches =
                            new XElement("Batches",
                                         new XElement("Batch",
                                                      new XElement("PrintCount", txtPrintNumber.Text),
                                                      new XElement("PrintedByID", Session["UserID"]),
                                                      new XElement("PrintDate", DateTime.Now.ToString("MM-dd-yyyy h:m:s"))
                                                      )
                                         );
                        pe.PrintBatches = Batches;
                        int result = st_dll.PrintBatchDetails("dbo.spProductLabelPrintBatchDetails", "IN", pe);
                    }
                    else
                    {
                        XElement Batch =
                            new XElement("Batch",
                                         new XElement("PrintCount", txtPrintNumber.Text),
                                         new XElement("PrintedByID", Session["UserID"]),
                                         new XElement("PrintDate", DateTime.Now.ToString("MM-dd-yyyy h:m:s"))
                                         );
                        pe.PrintBatches = Batch;
                        int result = st_dll.PrintBatchDetails("dbo.spProductLabelPrintBatchDetails", "U", pe);
                    }
                    txtPrintNumber.Text = "";
                    BindQAGrid();
                }
                else
                {
                    ErrorMessage("QA Approval is pending!");
                }
                //Printing to BarTender Machine
                // BarTenderPrintingLable(pe.ControlID);
            }
            catch (Exception ex)
            {
                ErrorMessage(ex.Message);
            }
        }
Esempio n. 11
0
        public int ReadLabelData(string labeldata)
        {
            ProductsEntity pe = new ProductsEntity();

            pe.ControlID    = Convert.ToInt32(labeldata.Split(',')[0]);
            pe.AppliedByID  = Convert.ToInt32(Context.Session["UserID"]);
            pe.LabelNo      = Convert.ToInt32(labeldata.Split(',')[1].TrimStart('0'));
            pe.categorycode = Convert.ToInt32(labeldata.Split(',')[2]);
            pe.LabelStatus  = Convert.ToInt32(labeldata.Split(',')[3]);
            int result = gpls.ReadLabel(pe);

            return(result);
        }
Esempio n. 12
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            try
            {
                ProductsEntity pe = new ProductsEntity();


                string fieldName = ddFilter.SelectedItem.Value;

                switch (fieldName)
                {
                case "LotNo":
                    pe.LotNo = txtfilter.Text;
                    break;

                case "ProductDesc":
                    pe.ProductDesc = txtfilter.Text;
                    break;

                case "LabelCount":
                    pe.labelCount = Convert.ToInt32(txtfilter.Text);
                    break;

                case "ManufacturingDate":
                    pe.ManufacturingDate = Convert.ToDateTime(txtfilter.Text);
                    break;

                case "ExpirationDate":
                    pe.ExpirationDate = Convert.ToDateTime(txtfilter.Text);
                    break;

                default:
                    break;
                }
                DataTable dt = st_dll.ProductSearch("dbo.spProductSearch", pe);

                if (dt.Rows.Count > 0)
                {
                    grvProductLabeling.DataSource = dt;
                    grvProductLabeling.DataBind();
                }
                else
                {
                    ErrorMessage("No records found.Please search with different criteria.");
                }
            }
            catch (Exception ex)
            {
                ErrorMessage(ex.Message);
            }
        }
Esempio n. 13
0
        private int SaveQAsign()
        {
            try
            {
                if (ddqanames.SelectedValue != null)
                {
                    int result = VerifyEsign(Convert.ToInt32(hdnqanames.Value), txtsignature.Text);
                    if (result != 0)
                    {
                        ProductsEntity pe = new ProductsEntity();

                        if (rbtApproval.Checked)
                        {
                            pe.ApprovedByID = Convert.ToInt32(hdnqanames.Value);
                        }
                        else
                        {
                            pe.RejectedByID = Convert.ToInt32(hdnqanames.Value);
                            pe.StatusReason = Convert.ToInt32(hdnRejectedReasons.Value);
                        }
                        pe.ControlID    = Convert.ToInt32(hdnControlid.Value);
                        pe.categorycode = categorycode;

                        int result_status = 0;
                        result_status = st_dll.InsertQASign("dbo.stProductsLabeling", "QS", pe);
                        if (rbtApproval.Checked)
                        {
                            result_status = 1;
                        }
                        else
                        {
                            result_status = 2;
                        }
                        return(result_status);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                ErrorMessage(ex.Message);
                return(0);
            }
        }
Esempio n. 14
0
        private int UpdateProductDetails()
        {
            try
            {
                //SqlCommand cmd = new SqlCommand("dbo.stCRUDProductDetails", conn);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@ProductID", Convert.ToInt32(ViewState["ProductID"]));
                //cmd.Parameters.AddWithValue("@ProductDesc", txtProductDesc.Text);
                //cmd.Parameters.AddWithValue("@Type", "U");
                //cmd.Parameters.AddWithValue("@SKUNo", txtSKUNo.Text);
                //cmd.Parameters.AddWithValue("@LastUserID", username);
                //cmd.ExecuteNonQuery();

                ProductsEntity pe = new ProductsEntity();
                pe.productid        = Convert.ToInt32(hdnproductid.Value);
                pe.ProductDesc      = txtProductDesc.Text;
                pe.SKUNo            = txtSKUNo.Text;
                pe.ItemDesc         = txtItemDesc.Text;
                pe.StorageCondition = txtStoragecond.Text;
                pe.MasterFormat     = Convert.ToInt32(ddlMasterLabels.SelectedValue);
                pe.InsertFormat     = Convert.ToInt32(ddlInsertLabelFormat.SelectedValue);
                pe.CaseFormat       = Convert.ToInt32(ddlCaseLabelFormat.SelectedValue);
                //if (txtUnitsize.Text != "") {
                //    pe.Unitsize = Convert.ToInt32(txtUnitsize.Text);
                //}
                if (txtUnits.Text != "")
                {
                    pe.Units = Convert.ToInt32(txtUnits.Text);
                }
                if (rbtUnits.Checked)
                {
                    pe.UnitType = 1;
                }
                else if (rbtBags.Checked)
                {
                    pe.UnitType = 2;
                }
                //pe.UnitType = Convert.ToInt32(rdUnit.SelectedItem.Value);
                pe.categorycode = Convert.ToInt32(ddlCategory.SelectedItem.Value);
                //pe.casesize = Convert.ToInt32(txtCasesize.Text);
                pe.LastUserID = Convert.ToInt32(Session["UserID"]);
                return(st_dll.UpdateProduct(pe));
            }
            catch (Exception ex)
            {
                ErrorMessage(ex.Message);
                return(0);
            }
        }
Esempio n. 15
0
        private int AddProductDetails()
        {
            try
            {
                ProductsEntity pe = new ProductsEntity();
                pe.ProductDesc      = txtProductDesc.Text;
                pe.SKUNo            = txtSKUNo.Text;
                pe.StorageCondition = txtStoragecond.Text;
                pe.ItemDesc         = txtItemDesc.Text;
                pe.MasterFormat     = Convert.ToInt32(ddlMasterLabels.SelectedValue);
                pe.InsertFormat     = Convert.ToInt32(ddlInsertLabelFormat.SelectedValue);
                pe.CaseFormat       = Convert.ToInt32(ddlCaseLabelFormat.SelectedValue);

                //.Replace("\r\n", "<br/>"); ;
                //if (txtUnitsize.Text != "") {
                //    pe.Unitsize = Convert.ToInt32(txtUnitsize.Text);
                //}
                //pe.Units = Convert.ToInt32(txtUnits.Text);
                if (txtUnits.Text != "")
                {
                    pe.Units = Convert.ToInt32(txtUnits.Text);
                }
                if (rbtUnits.Checked)
                {
                    pe.UnitType = 1;
                }
                else if (rbtBags.Checked)
                {
                    pe.UnitType = 2;
                }
                //else {
                //    pe.UnitType = Convert.ToInt32(rdUnit.SelectedItem.Value);
                //}

                pe.categorycode = Convert.ToInt32(ddlCategory.SelectedItem.Value);
                //pe.casesize = Convert.ToInt32(txtCasesize.Text);
                pe.CreatedBy  = Convert.ToInt32(Session["UserID"]);
                pe.LastUserID = Convert.ToInt32(Session["UserID"]);
                return(st_dll.InsertProduct(pe));
            }
            catch (Exception ex)
            {
                ErrorMessage(ex.Message);
                return(0);
            }
        }
Esempio n. 16
0
        public int GetLabelCountToAdd(string data)
        {
            int            totallablecount = Convert.ToInt32(data.Split(',')[1]) + Convert.ToInt32(data.Split(',')[4]);
            ProductsEntity pe = new ProductsEntity();

            pe.ControlID    = Convert.ToInt32(data.Split(',')[0]);
            pe.categorycode = Convert.ToInt32(data.Split(',')[2]);
            pe.batchid      = Convert.ToInt32(data.Split(',')[3]);
            //DataTable dt = st_dll.GetDBData("dbo.spGenerateLabels", "S", pe);
            DataTable dt = gpls.GetLabelCountToAdd(pe);
            var       not_voidedcount = (from t in dt.AsEnumerable()
                                         where t.Field <bool?>("Voided") != true
                                         select t).ToList().Count;
            int count = gpls.GetLabelCount(pe);

            //var query = (from t in dt.AsEnumerable()
            //             where t.Field<string>("LABELSTATUS") == "Added"
            //             select t).ToList().Count;
            int total;

            if (dt.Rows.Count > 0)
            {
                if (pe.categorycode == 4)//CASE
                {
                    //int labelcount1 = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(count) / Convert.ToDouble(dt.Rows[0]["CASESIZE"])));
                    //total = Convert.ToInt32(labelcount1) - not_voidedcount;
                    total = count - not_voidedcount;
                }
                else if (pe.categorycode == 3)
                {//INSERT
                    total = count - not_voidedcount;
                }
                else
                {
                    //total = Convert.ToInt32(dt.Rows[0]["labelcount"]) - not_voidedcount;
                    total = count - not_voidedcount;
                }
            }
            else
            {
                total = 0;
            }
            return(total);
        }
Esempio n. 17
0
        public void GenerateCaseLabels(int casecount)
        {
            ProductsEntity pe         = new ProductsEntity();
            int            controlid  = Convert.ToInt32(hdnControlid.Value);
            DataTable      dt1        = st_dll.GetCaseOfData(controlid);
            int            labelcount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(casecount) / Convert.ToDouble(dt1.Rows[0]["CASESIZE"])));

            pe.ControlID    = controlid;
            pe.categorycode = 3;
            //st_dll.SaveCaseOfData(txtcase.Text, controlid);
            DataTable dt = st_dll.GetDBData("dbo.spGenerateLabels", "S", pe);

            if (dt.Rows.Count == 0)
            {
                GenerateLables(controlid, labelcount, 3);
                st_dll.InsertIntoCaseSize(controlid, 3);
            }
            // Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "OpenWindow('" + controlid + "','" + labelcount + "','" + 3 + "');", true);
        }
Esempio n. 18
0
        protected void btnTestPrintLabels_Click(object sender, EventArgs e)
        {
            try
            {
                ProductsEntity pe = new ProductsEntity();
                pe.formatname   = hdnLabelFormatName.Value.ToString();
                pe.ControlID    = Convert.ToInt32(hdnCheckedControlid.Value);
                pe.categorycode = Convert.ToInt32(hdnCheckedCategoryCode.Value);
                pe.labelCount   = 1;
                pe.batchid      = Convert.ToInt32(hdnCheckedBatchID.Value);
                pe.PrintedByID  = Convert.ToInt32(Session["UserID"]);
                pe.PONo         = txtPoNo.Text != "" ? txtPoNo.Text : "N/A";
                //int po_result = st_dll.UpdatePONo("dbo.spUpdateCasePONo", pe);
                //if (po_result != 1)
                //{
                //    ErrorMessage("Error in Updating PoNo.");
                //}

                if (pe.formatname != "")
                {
                    //int result = 1;// BarTenderPrintingLable(pe.ControlID, pe.labelCount, pe.categorycode, pe.formatname,pe.batchid);
                    int result = 0;

                    if (BarTenderStatus == "1")
                    {
                        result = BarTenderPrintingLable(pe.ControlID, pe.labelCount, pe.categorycode, pe.formatname, pe.batchid, 1);
                    }
                    else
                    {
                        result = 1;
                    }
                }
                else
                {
                    ErrorMessage("Unable to print.Error in getting filename.");
                }
            }
            catch (Exception ex)
            {
                ErrorMessage("Printing error " + ex.Message);
            }
        }
Esempio n. 19
0
 private int AddProductLabelDetails()
 {
     try
     {
         ProductsEntity pe = new ProductsEntity();
         pe.ManufacturingDate = Convert.ToDateTime(txtManufacturingDate.Text + " " + DateTime.Now.ToString("HH:mm:ss tt"));
         pe.ExpirationDate    = Convert.ToDateTime(txtExpirationDate.Text + " " + DateTime.Now.ToString("HH:mm:ss tt"));
         pe.productid         = Convert.ToInt32(ddproducts.SelectedItem.Value);
         pe.LotNo             = txtlotno.Text;
         pe.labelCount        = Convert.ToInt32(txtNoLables.Text);
         pe.CreatedBy         = Convert.ToInt32(Session["UserID"]);
         pe.LastUserID        = Convert.ToInt32(Session["UserID"]);
         pe.PONo = hdnPONo.Value.ToString();
         return(st_dll.AddProductLabelDetails("dbo.stProductsLabeling", "IN", pe));
     }
     catch (Exception ex)
     {
         ErrorMessage(ex.Message);
         return(0);
     }
 }
Esempio n. 20
0
        //public void DiablePrintTotext(int controlId, int categorycode) {
        //    DataTable Product_dt = st_dll.GetProductType("dbo.spGetProductType", controlId);

        //    int producttype = Convert.ToInt32(Product_dt.Rows[0]["PRODUCTTYPE"]);

        //    if (producttype == 1)
        //    {
        //        if (categorycode == 1 || categorycode == 2 || categorycode == 3)
        //        {
        //            txtTotalLabelsremaningtoprint.ReadOnly = true;
        //        }
        //        else {
        //            txtTotalLabelsremaningtoprint.ReadOnly = false;
        //        }
        //    }
        //    else {

        //        if (categorycode == 2 || categorycode == 3)
        //        {
        //            txtTotalLabelsremaningtoprint.ReadOnly = true;
        //        }
        //        else {
        //            txtTotalLabelsremaningtoprint.ReadOnly = false;
        //        }
        //    }
        //}
        public void GenerateCaseLabels(int controlId, int categorycode)
        {
            ProductsEntity pe = new ProductsEntity();

            DataTable dt1 = st_dll.GetCaseOfData(controlId);

            pe.ControlID    = controlId;
            pe.categorycode = 3;

            DataTable dt         = st_dll.GetData("dbo.spGetLabelToPrintForCase", pe);
            int       labelcount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(dt.Rows[0]["TOTAL_LABELS_TO_PRINT"]) / Convert.ToDouble(dt1.Rows[0]["CASESIZE"])));

            //st_dll.SaveCaseOfData(txtcase.Text, controlid);
            //DataTable dt2 = st_dll.GetDBData("dbo.spGenerateLabels", "S", pe);
            if (Convert.ToInt32(dt.Rows[0]["TOTAL_LABELS_TO_PRINT"]) > 0)
            {
                GenerateLables(controlId, labelcount, 3);
            }
            BindGrid(1, 100);
            // Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "OpenWindow('" + controlid + "','" + labelcount + "','" + 3 + "');", true);
        }
Esempio n. 21
0
        private void BindGrid(int pageno, int noOfRecords)
        {
            ProductsEntity pe = new ProductsEntity();

            pe.ControlID    = controlId;
            pe.categorycode = categorycode;
            pe.Pageno       = pageno;
            pe.NoOfRecords  = noOfRecords;
            int total = 0;
            //DataTable dt = st_dll.GetDBData("dbo.spGenerateLabels", "S", pe);
            DataTable dt = st_dll.GetPagingData("dbo.GetLabelPaging", pe, out total);

            ViewState["LabelsData"] = dt;
            grvPrinting.DataSource  = dt;
            grvPrinting.DataBind();



            ViewState["TotalRecord"] = total;
            ViewState["NoOfRecord"]  = noOfRecords;
            //GetLabelCountToAdd();
        }
Esempio n. 22
0
 protected void btnPending_Click(object sender, EventArgs e)
 {
     try
     {
         ProductsEntity pe = new ProductsEntity();
         pe.Status = 2;
         DataTable dt = st_dll.ProductSearch("dbo.spInsertLabelSearch", pe);
         if (dt.Rows.Count > 0)
         {
             grvInsertLabeling.DataSource = dt;
             grvInsertLabeling.DataBind();
         }
         else
         {
             ErrorMessage("No records found.Please search with different criteria.");
         }
     }
     catch (Exception ex)
     {
         ErrorMessage(ex.Message);
     }
 }
Esempio n. 23
0
        public void AddBartenderFileToFolder(ProductsEntity pe)
        {
            try
            {
                string filename = "SKU" + pe.productid.ToString() + "_" + pe.categorycode.ToString() + "_" + pe.formatno.ToString();

                string folderName = @"\\glpdc01\corp\IT Files\GPLS\BarTenderFiles\";
                string fileName   = filename + ".btw";

                string pathString = System.IO.Path.Combine(folderName, fileName);

                if (!System.IO.File.Exists(pathString))
                {
                    using (System.IO.FileStream fs = System.IO.File.Create(pathString)) {
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessage("Error in adding file to folder " + ex.Message);
            }
        }
Esempio n. 24
0
 protected void btnRead_Click(object sender, EventArgs e)
 {
     try
     {
         ProductsEntity pe = new ProductsEntity();
         pe.ControlID   = Convert.ToInt32(hdnControlid.Value);
         pe.AppliedByID = Convert.ToInt32(Session["UserID"]);
         int result = st_dll.PrintBatchDetails("dbo.spProductLabelPrintBatchDetails", "RU", pe);
         if (result == 0)
         {
             ErrorMessage("Reconcilation failed !");
         }
         else
         {
             SucessMessage("Reconcilation is successfull !");
             BindQAGrid();
         }
     }
     catch (Exception ex)
     {
         ErrorMessage(ex.Message);
     }
 }
Esempio n. 25
0
        private int SaveQAsign()
        {
            try
            {
                //SqlCommand cmd = new SqlCommand("dbo.stProductsLabeling", conn);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@Type", "QS");
                //cmd.Parameters.AddWithValue("@ApprovedByID", ddqanames.SelectedValue);
                //cmd.Parameters.AddWithValue("@ControlID", hdnControlid.Value);
                //cmd.ExecuteNonQuery();

                if (ddqanames.SelectedValue != null)
                {
                    int result = VerifyEsign(Convert.ToInt32(ddqanames.SelectedValue), txtsignature.Text);
                    if (result != 0)
                    {
                        ProductsEntity pe = new ProductsEntity();
                        pe.ApprovedByID = Convert.ToInt32(ddqanames.SelectedValue);
                        pe.ControlID    = Convert.ToInt32(hdnControlid.Value);
                        return(st_dll.InsertQASign("dbo.stProductsLabeling", "QS", pe));
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                ErrorMessage(ex.Message);
                return(0);
            }
        }
Esempio n. 26
0
        protected void btnTestPrintLabels_Click(object sender, EventArgs e)
        {
            try
            {
                ProductsEntity pe = new ProductsEntity();
                pe.formatname   = hdnLabelFormatName.Value.ToString();
                pe.ControlID    = Convert.ToInt32(hdnCheckedControlid.Value);
                pe.categorycode = Convert.ToInt32(hdnCheckedCategoryCode.Value);
                pe.labelCount   = 1;
                pe.batchid      = Convert.ToInt32(hdnCheckedBatchID.Value);
                pe.PrintedByID  = Convert.ToInt32(Session["UserID"]);


                if (pe.formatname != "")
                {
                    int result = 0;

                    if (BarTenderStatus == "1")
                    {
                        result = BarTenderPrintingLable(pe.ControlID, pe.labelCount, pe.categorycode, pe.formatname, pe.batchid, 1);
                    }
                    else
                    {
                        result = 1;
                    }
                }
                else
                {
                    ErrorMessage("Unable to print test file.Error in getting filename.");
                }
            }
            catch (Exception ex)
            {
                ErrorMessage("Printing error " + ex.Message);
            }
        }
Esempio n. 27
0
        protected void grvQaApproval_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Preview")
            {
                //int controlid = Convert.ToInt16(e.CommandArgument);
                //Session["Controlid"] = controlid;
                ////Response.Redirect("Reportpage.aspx");
                ////Server.Transfer("");

                //Page.ClientScript.RegisterStartupScript(
                //this.GetType(), "OpenWindow", "window.open('Reportpage.aspx','_newtab');", true);
            }
            else if (e.CommandName == "Print")
            {
                GridColumns();
                ProductsEntity pe         = new ProductsEntity();
                int            controlid  = Convert.ToInt32(hdnControlid.Value);
                int            labelcount = Convert.ToInt32(hdnlabelcount.Value);
                pe.ControlID    = controlid;
                pe.categorycode = 1;
                DataTable dt = st_dll.GetDBData("dbo.spGenerateLabels", "S", pe);
                if (dt.Rows.Count == 0)
                {
                    GenerateLables(controlid, labelcount, 1);
                    //SendEmailtoQA("Product");
                }
                //Session["ControlID"] = controlid.ToString();
                //Session["labelcount"] = labelcount.ToString();
                //Session["categorycode"] = "1";
                // BarTenderPrintingLable(controlid);
                //Session["Controlid"] = controlid;

                //Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "OpenWindow('" + controlid + "','" + labelcount + "','" + 1 + "');", true);

                //Response.Redirect("Printing.aspx",false);
                Response.Redirect("Printing.aspx?ctrid=" + controlid.ToString() + "&lc=" + labelcount.ToString() + "&cc=1", false);
            }
            else if (e.CommandName == "Component")
            {
                GridColumns();
                ProductsEntity pe         = new ProductsEntity();
                int            controlid  = Convert.ToInt32(hdnControlid.Value);
                int            labelcount = Convert.ToInt32(hdnlabelcount.Value);
                pe.ControlID    = controlid;
                pe.categorycode = 4;
                DataTable dt = st_dll.GetDBData("dbo.spGenerateLabels", "S", pe);
                if (dt.Rows.Count == 0)
                {
                    GenerateLables(controlid, labelcount, 4);
                    //SendEmailtoQA("Component");
                }
                //Session["ControlID"] = controlid.ToString();
                //Session["labelcount"] = labelcount.ToString();
                //Session["categorycode"] = "4";
                //Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "OpenWindow('" + controlid + "','" + labelcount + "','" + 4 + "');", true);
                //Response.Redirect("Printing.aspx", false);
                Response.Redirect("Printing.aspx?ctrid=" + controlid.ToString() + "&lc=" + labelcount.ToString() + "&cc=4", false);
            }
            else if (e.CommandName == "Insert")
            {
                //GridColumns();
                //ProductsEntity pe = new ProductsEntity();
                //int controlid = Convert.ToInt32(hdnControlid.Value);
                //int labelcount = st_dll.GetLabelCount(controlid);
                //pe.ControlID = controlid;
                //pe.categorycode = 2;
                //DataTable dt = st_dll.GetDBData("dbo.spGenerateLabels", "S", pe);
                //if (dt.Rows.Count == 0)
                //{
                //    GenerateLables(controlid, labelcount, 2);
                //    int unitsize = st_dll.GetUnitSize(controlid);
                //    if (unitsize != 0) {
                //        st_dll.InsertIntoCaseSize(controlid, 2);
                //    }

                //    GenerateCaseLabels(labelcount);


                //}

                //Response.Redirect("Printing.aspx?ctrid=" + controlid.ToString() + "&lc=" + labelcount.ToString() + "&cc=2", false);
            }
            else if (e.CommandName == "Case")
            {
                GridColumns();
                int       controlid  = Convert.ToInt32(hdnControlid.Value);
                DataTable dt         = st_dll.GetCaseOfData(controlid);
                int       labelcount = Convert.ToInt32(Math.Round(Convert.ToDouble(hdnlabelcount.Value) / Convert.ToDouble(dt.Rows[0]["CASESIZE"])));
                //Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenCaseWindow", "OpenCaseModal('" + controlid + "','" + labelcount + "','" + 3 + "');", true);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "OpenWindow('" + controlid + "','" + labelcount + "','" + 3 + "');", true);
            }
        }
Esempio n. 28
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            ProductsEntity pe = new ProductsEntity();


            string fieldName = ddFilter.SelectedItem.Value;

            switch (fieldName)
            {
            case "LotNo":
                pe.LotNo = txtfilter.Text;
                break;

            case "ProductDesc":
                pe.ProductDesc = txtfilter.Text;
                break;

            case "LabelCount":
                pe.labelCount = Convert.ToInt32(txtfilter.Text);
                break;

            case "ManufacturingDate":
                pe.ManufacturingDate = Convert.ToDateTime(txtfilter.Text);
                break;

            case "ExpirationDate":
                pe.ExpirationDate = Convert.ToDateTime(txtfilter.Text);
                break;

            default:
                break;
            }
            DataTable dt = st_dll.ProductSearch("dbo.spProductSearch", pe);

            if (dt.Rows.Count > 0)
            {
                grvQaApproval.DataSource = dt;
                grvQaApproval.DataBind();
            }
            else
            {
                ErrorMessage("No records found.Please search with different criteria.");
            }


            //if (ViewState["QADetails"] != null)
            //{

            //    DataTable dt = (DataTable)ViewState["QADetails"];
            //    DataView view = new DataView();
            //    string fieldName = ddFilter.SelectedItem.Value;

            //    if (fieldName == "ProductDesc" || fieldName == "LotNo")
            //    {
            //        var query = from t in dt.AsEnumerable()
            //                    where t.Field<string>(fieldName).Contains(txtfilter.Text.ToString())
            //                    select t;
            //        view = query.AsDataView();
            //        grvQaApproval.DataSource = view;
            //        grvQaApproval.DataBind();

            //    }

            //    else if (fieldName == "0")
            //    {
            //        grvQaApproval.DataSource = dt;
            //        grvQaApproval.DataBind();

            //    }
            //}
        }
Esempio n. 29
0
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            // btnPrint.Enabled = false;
            DataTable dt = st_dll.GetLabelCountData("dbo.spGenerateLabels", "C", controlId, categorycode);

            if (Convert.ToInt32(dt.Rows[0]["LabelCount"]) > 0)
            {
                ProductsEntity pe = new ProductsEntity();
                pe.ControlID    = controlId;
                pe.PrintedByID  = Convert.ToInt32(Session["UserID"]);
                pe.categorycode = categorycode;


                if (txtTotalLabelsremaningtoprint.Text != "")
                {
                    pe.toPrint = Convert.ToInt32(txtTotalLabelsremaningtoprint.Text);
                    int print_result = 1;// BarTenderPrintingLable(controlId, Convert.ToInt32(txtTotalLabelsremaningtoprint.Text), categorycode);
                    if (print_result != 0)
                    {
                        int result = st_dll.UpdatePrinting("dbo.spUpdatePrinting", pe);

                        if (result != 0)
                        {
                            if (categorycode == 2)
                            {
                                ddlLabelFormats.SelectedValue = "0";
                                ProductsEntity pe1 = new ProductsEntity();
                                pe1.ControlID    = controlId;
                                pe1.PrintedByID  = Convert.ToInt32(Session["UserID"]);
                                pe1.categorycode = 3;

                                DataTable dt2 = st_dll.GetLabelCountData("dbo.spGenerateLabels", "C", controlId, 3);
                                pe1.toPrint = Convert.ToInt32(dt2.Rows[0]["LabelCount"]);
                                System.Threading.Thread.Sleep(2000);
                                int case_result = 1; BarTenderPrintingLable(controlId, Convert.ToInt32(dt2.Rows[0]["LabelCount"]), 3);
                                //DelayMethod(controlId, Convert.ToInt32(dt2.Rows[0]["LabelCount"]), categorycode);
                                if (case_result != 0)
                                {
                                    st_dll.UpdatePrinting("dbo.spUpdatePrinting", pe1);
                                }
                            }
                            BindGrid(1, 100);
                            CheckLabelPrint(controlId, categorycode);
                            SucessMessage("The labels are printed successfully!");
                        }
                        else
                        {
                            ErrorMessage("Failed to Save the Print Data!");
                        }
                    }
                    else
                    {
                        ErrorMessage("Failed to Print the Label in BarTender!");
                    }
                }
                else
                {
                    ErrorMessage("Please select how many labels you want to print!");
                }
            }
            else
            {
                ErrorMessage("All labels are printed!");
            }
            // btnPrint.Enabled = true;
        }