protected void btnCancel_Click(object sender, EventArgs e)
        {
            var date1 = GeneralUtility.ConvertDisplayDateStringFormat(System.DateTime.Now);

            date          = GeneralUtility.ConvertSystemDateStringFormat(txtMonth.Text);
            txtMonth.Text = date1.Substring(3, 7).ToString();

            this.hdID.Value               = string.Empty;
            this.hdProject.Value          = string.Empty;
            this.ddlPROJECT.SelectedIndex = 0;
            this.txtProbes.Text           = string.Empty;
            this.txtPricingProbes.Text    = string.Empty;
            this.txtMasks.Text            = string.Empty;
            this.txtRepricing.Text        = string.Empty;
            this.txtScenes.Text           = string.Empty;
            this.txtSceneRecog.Text       = string.Empty;
            this.txtCategoryExpert.Text   = string.Empty;
            ddlPROJECT.Enabled            = true;
            btnSubmit.Text = "Search";
            divProbes.Attributes.Add("style", "display:none");
            divPricing.Attributes.Add("style", "display:none");
            divMask.Attributes.Add("style", "display:none");
            divRepricing.Attributes.Add("style", "display:none");
            divSceneRecog.Attributes.Add("style", "display:none");
            divScene.Attributes.Add("style", "display:none");
            divExpert.Attributes.Add("style", "display:none");
            BindGrid();
        }
Ejemplo n.º 2
0
        public void BuildSQLParameters()
        {
            for (int index = 0; index < mContext.mKeyVal.Count; index++)
            {
                string col = mContext.mKeyVal[index].ColumnName;

                string value = mContext.mKeyVal[index].ColumnName;

                if (mContext.mKeyVal[index].IsDateField && !string.IsNullOrWhiteSpace((string)mContext.mKeyVal[index].Value))
                {
                    mContext.mSQLParameters.Add(new SqlParameter
                    {
                        ParameterName = mContext.mKeyVal[index].ColumnName.Replace("[", "").Replace("]", ""),

                        Value = GeneralUtility.ConvertSystemDateStringFormat(((string)mContext.mKeyVal[index].Value).Trim())
                    });
                }
                else
                {
                    mContext.mSQLParameters.Add(new SqlParameter
                    {
                        ParameterName = "@" + mContext.mKeyVal[index].ColumnName.Replace("[", "").Replace("]", ""),

                        Value = mContext.mKeyVal[index].Value ?? DBNull.Value
                    });
                }
            }
        }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var date1 = GeneralUtility.ConvertDisplayDateStringFormat(System.DateTime.Now);
         date          = GeneralUtility.ConvertSystemDateStringFormat(txtMonth.Text);
         txtMonth.Text = date1.Substring(3, 7).ToString();
     }
 }
Ejemplo n.º 4
0
        private void QAT_BindBusiness(List <QATEntity> QATlist, ExcelWorksheet ws, string center)
        {
            var userEntity = (UserEntity)Session["ID"];

            for (var rowNumber = 1; rowNumber <= ws.Dimension.End.Row; rowNumber++)
            {
                var qatEntity = new QATEntity();

                qatEntity.ID = GeneralUtility.GeneratedKey;

                #region Populate Excel data

                for (var colNumber = 1; colNumber <= ws.Dimension.End.Column; colNumber++)
                {
                    // var columnName1 = ws.Cells[1, colNumber].Value.ToString().Trim();
                    try
                    {
                        if (true)
                        {
                            switch (colNumber)
                            {
                                #region
                            case 1:
                                qatEntity.QAT = Convert.ToString(ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 2:
                                qatEntity.Name = Convert.ToString(ws.Cells[rowNumber, colNumber].Value);
                                break;


                            default: break;

                                #endregion
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("error.aspx");
                        throw ex;
                    }
                }


                qatEntity.CreatedDate = GeneralUtility.ConvertSystemDateStringFormat(txtImportDate.Text.Trim());
                qatEntity.Month       = GeneralUtility.ConvertMonthYearStringFormat(txtImportDate.Text);
                qatEntity.Center      = ddlCenterName.SelectedValue.ToString();
                qatEntity.Createdby   = userEntity.ID;


                QATlist.Add(qatEntity);

                #endregion
            }
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var Probes = new Probes();
                var result = Probes.FindAllBranch();

                for (int i = 0; i < result.Count; i++)
                {
                    ddlCenterName.Items.Insert(i, new ListItem(result[i].BranchName, result[i].BranchCode));
                }
                var date1 = GeneralUtility.ConvertDisplayDateStringFormat(System.DateTime.Now);
                date = GeneralUtility.ConvertSystemDateStringFormat(txtImportDate.Text);
                txtImportDate.Text = date1.Substring(3, 7).ToString();
            }
        }
        private void ProjectName_BindBusiness(List <ProjectNamesEntity> projectnamelist, ExcelWorksheet ws)
        {
            for (var rowNumber = 1; rowNumber <= 1; rowNumber++)
            {
                #region Populate Excel data

                for (var colNumber = 1; colNumber <= ws.Dimension.End.Column; colNumber++)
                {
                    var projectnameEntity = new ProjectNamesEntity();
                    var columnName1       = ws.Cells[1, colNumber].Value.ToString().Trim();
                    // var columnName2 = string.Empty;

                    try
                    {
                        if (true)
                        {
                            projectnameEntity.ID          = GeneralUtility.GeneratedKey;
                            projectnameEntity.PROJECT     = columnName1;
                            projectnameEntity.Sheet       = ddlJobName.SelectedValue;
                            projectnameEntity.Status      = ddlStatus.SelectedValue;
                            projectnameEntity.CreatedDate = GeneralUtility.ConvertSystemDateStringFormat(txtImportDate.Text.Trim());//GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now);
                            projectnameEntity.ImportMonth = GeneralUtility.ConvertMonthYearStringFormat(txtImportDate.Text);
                            projectnameEntity.Createdby   = "admin";
                            projectnamelist.Add(projectnameEntity);
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("error.aspx");
                        throw ex;
                    }
                }



                //if (rowNumber== 1)
                //{
                //    projectnameEntity.CreatedDate = GeneralUtility.ConvertSystemDateStringFormat(txtImportDate.Text.Trim());//GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now);
                //    projectnameEntity.ImportMonth = GeneralUtility.ConvertMonthYearStringFormat(txtImportDate.Text);
                //    projectnameEntity.Createdby = "admin";
                //    projectnamelist.Add(projectnameEntity);
                //}


                #endregion
            }
        }
Ejemplo n.º 7
0
        public void ExcuteInsertCommand <B>(B aEntity, string con) where B : EntityBase, new()
        {
            aEntity.CreatedDate = GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now);

            SqlConnection l_Connection = new SqlConnection(con);

            SqlCommand l_Command = new SqlCommand();

            l_Command.Connection = l_Connection;

            var l_InsertQuery = new InsertSqlBuilder <B>(aEntity);

            QueryDirector <B> l_Construct = new QueryDirector <B>(l_InsertQuery);

            var l_Context = l_Construct.GetDataContext();

            l_Command.CommandTimeout = 0;


            l_Command.CommandText = l_Context.mSQL;

            foreach (var l_SQLParameters in l_Context.mSQLParameters)
            {
                l_Command.Parameters.Add(l_SQLParameters);
            }

            try
            {
                l_Connection.Open();

                l_Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                l_Connection.Close();
            }
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!IsPostBack)
                {
                    var date1 = GeneralUtility.ConvertDisplayDateStringFormat(System.DateTime.Now);
                    date          = GeneralUtility.ConvertSystemDateStringFormat(txtMonth.Text);
                    txtMonth.Text = date1.Substring(3, 7).ToString();

                    divProbes.Attributes.Add("style", "");
                    divPricing.Attributes.Add("style", "");
                    divMask.Attributes.Add("style", "");

                    divRepricing.Attributes.Add("style", "");
                    divSceneRecog.Attributes.Add("style", "");
                    divScene.Attributes.Add("style", "");

                    divExpert.Attributes.Add("style", "");
                    BindGrid();
                }
            }
        }
        protected void btnExport_Click(object sender, EventArgs e)
        {
            if (txtMonth.Text != "" && txtMonth.Text != null)
            {
                #region "For Above 96%+5K"

                string count1 = "0";
                string count2 = "0";

                calculateMonth = GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim());

                //calculateFromDate = calculateMonth + "16";  //calculateFromDate

                calculateToDate = calculateMonth + "15";  //calculateToDate

                string   calculatedate = new AccuracyPercentage().FindPreviousMonth(calculateToDate);
                DateTime calfromtime   = DateTime.Parse(calculatedate);
                var      cdate         = GeneralUtility.ConvertSystemDateStringFormat(calfromtime);
                string   cmonth        = cdate.Substring(4, 2);
                string   cyear         = cdate.Substring(0, 4);
                cMonth2 = cyear + cmonth;

                //calculateToDate = cMonth2 + "15"; //calculateToDate

                calculateFromDate = cMonth2 + "16"; //calculateFromDate

                if ((txtFromDate.Text == "" || txtFromDate.Text == null) || (txtToDate.Text == "" || txtToDate.Text == null))
                {
                    MessageBox.MessageShow(this.GetType(), "Please Choose From/To Date!.", ClientScript);
                    return;
                }

                else
                {
                    fromDate = GeneralUtility.ConvertSystemDateStringFormat(txtFromDate.Text);
                    toDate   = GeneralUtility.ConvertSystemDateStringFormat(txtToDate.Text);

                    DateTime dtStartDate = DateTime.ParseExact(GeneralUtility.ConvertDisplayDateStringFormat(this.txtFromDate.Text.Trim()), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    DateTime dtEndDate   = DateTime.ParseExact(GeneralUtility.ConvertDisplayDateStringFormat(this.txtToDate.Text.Trim()), "dd/MM/yyyy", CultureInfo.InvariantCulture);


                    count1 = new Probes().CheckDate(calculateFromDate, calculateToDate, fromDate);
                    count2 = new Probes().CheckDate(calculateFromDate, calculateToDate, toDate);

                    if (count1 == "0" || count2 == "0")
                    {
                        MessageBox.MessageShow(this.GetType(), "Please Check From/To Date Range!.", ClientScript);
                        return;
                    }

                    if ((dtEndDate.Date != dtStartDate.Date))
                    {
                        if (!(dtEndDate.Date > dtStartDate.Date))
                        {
                            MessageBox.MessageShow(this.GetType(), "Invalid End Date.", ClientScript);
                            //this.txtToDate.Focus();
                            return;
                        }
                    }

                    string fromYear  = fromDate.Substring(0, 4);
                    string fromMonth = fromDate.Substring(4, 2);

                    string toYear  = toDate.Substring(0, 4);
                    string toMonth = toDate.Substring(4, 2);

                    if (fromYear == toYear && fromMonth == toMonth)
                    {
                        Month1    = fromYear + fromMonth;
                        Month2    = string.Empty;
                        FromDate2 = string.Empty;
                        ToDate2   = string.Empty;
                    }
                    else
                    {
                        //string comparedate=new AccuracyPercentage().FindMonthAndYear(fromDate);
                        //string comparemonth = comparedate.Substring(3, 2);
                        //string compareyear = comparedate.Substring(6, 4);

                        string   comparedate  = new AccuracyPercentage().FindMonthAndYear(fromDate);
                        DateTime fromtime     = DateTime.Parse(comparedate);
                        var      fdate        = GeneralUtility.ConvertSystemDateStringFormat(fromtime);
                        string   comparemonth = fdate.Substring(4, 2);
                        string   compareyear  = fdate.Substring(0, 4);

                        if (compareyear != toYear || comparemonth != toMonth)
                        {
                            MessageBox.MessageShow(this.GetType(), "Please Check FromDate and ToDate!.", ClientScript);
                            return;
                        }

                        Month1    = fromYear + fromMonth;
                        Month2    = compareyear + comparemonth;
                        FromDate2 = Month2 + "01";
                        ToDate2   = toDate;
                        toDate    = new AccuracyPercentage().FindLastDayOfMonth(fromDate);
                    }
                }
                // FindByMonthFor3PA(branchcode, GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim()),fromDate,toDate,month2,fromDate2,toDate2);
                //@Center nvarchar(30),@Month nvarchar(30),@FromDate VARCHAR(8), @ToDate VARCHAR(8),@Month2 nvarchar(30),@FromDate2 VARCHAR(8), @ToDate2 VARCHAR(8)

                //var branchcode = string.Empty;

                //if (ddlCenterName.SelectedItem.Value != "All")
                //{
                //    branchcode = ddlCenterName.SelectedValue.ToString();
                //}

                var branchcode = string.Empty;

                if (ddlCenterName.SelectedIndex != 0)
                {
                    branchcode = ddlCenterName.SelectedValue.ToString();
                }
                else
                {
                    MessageBox.MessageShow(this.GetType(), "Please Choose Center!.", ClientScript);
                    return;
                }

                new Probes
                {
                    Criteria = new PPP_Project.Criteria.ImportJobsCriteria
                    {
                        CenterName = branchcode,
                        FromDate   = calculateFromDate,
                        ToDate     = calculateToDate,
                        Month1     = cMonth2,
                        Month2     = Month2,
                        FromDate2  = FromDate2,
                        ToDate2    = ToDate2,
                    }
                }.CalculateTotalProbes();

                var finalAccuracyList = new AccuracyPercentage().FindByMonthFor3PAGSS(branchcode, cMonth2, fromDate, toDate, Month2, FromDate2, ToDate2);

                DataTable attTbl = new DataTable();

                attTbl.Clear();
                attTbl.Columns.Clear();

                var result = (from dd in finalAccuracyList
                              orderby dd.QAT
                              select dd).ToList();

                // Convert to DataTable.
                DataTable table = ConvertToDataTable(result);

                table.Columns.Remove("RQuality");
                table.Columns.Remove("AmountforProbes");
                table.Columns.Remove("AmountforAccuracy");
                table.Columns.Remove("PPPA");
                table.Columns.Remove("Center");
                table.Columns.Remove("Month");
                table.Columns.Remove("Quality");
                table.Columns.Remove("Name");

                //int sum = finalProbesdt.AsEnumerable().Sum(s => s.Field<int>("Total Probes"));

                var      yrm  = GeneralUtility.ConvertSystemDateStringFormat(calculateToDate);
                int      yr   = Convert.ToInt32(yrm.Substring(0, 4).ToString());
                int      mth  = Convert.ToInt32(yrm.Substring(4, 2).ToString());
                DateTime date = new DateTime(yr, mth, 1);
                var      mm   = date.ToString("MMMM");
                var      yy   = date.ToString("yy");

                if (result.Count().Equals(0))
                {
                    MessageBox.MessageShow(GetType(), "No Export Data.!", ClientScript);
                }
                else
                {
                    var fileName = "3PA" + mm + "'" + yy + ".xlsx";
                    int count    = 0;
                    Response.Clear();
                    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                    //Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode("Probes_List_Export.xlsx", System.Text.Encoding.UTF8));
                    this.Response.AddHeader(
                        "content-disposition",
                        string.Format("attachment;  filename={0}", fileName));

                    ExcelPackage pkg = new ExcelPackage();

                    using (pkg)
                    {
                        ExcelWorksheet ws = pkg.Workbook.Worksheets.Add("3PA Ori");

                        ws.Cells["A1"].LoadFromDataTable(table, true);

                        #region "No need region"
                        // using (ExcelRange rng = ws.Cells["A1:W1"])
                        //  using (ExcelRange r = workSheet.Cells[startRowFrom, 1, startRowFrom, dataTable.Columns.Count])
                        using (ExcelRange rng = ws.Cells[1, 1, 1, table.Columns.Count])
                        {
                            rng.Style.Font.Bold = true;
                            //Set Pattern for the background to Solid
                            rng.Style.Fill.PatternType = ExcelFillStyle.Solid;
                            //Set color to dark blue
                            rng.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.FromArgb(79, 129, 189));
                            //  rng.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.FromArgb(122,160,205));
                            rng.Style.Font.Color.SetColor(System.Drawing.Color.White);
                        }

                        //ws.Cells["A1:MT"].Style.Font.Bold = true;
                        ////ws.Cells["A1"].Style.Font.Bold = true;
                        //using (ExcelRange rng = ws.Cells["A1:U" + (colcount - 1)])
                        //{
                        //    rng.Style.Font.Bold = true;
                        //}

                        //var headerCell = ws.Cells["A5:MT"];
                        //headerCell.Style.Fill.PatternType = ExcelFillStyle.Solid;
                        //headerCell.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.BurlyWood);
                        //var headerFont = headerCell.Style.Font;
                        //headerFont.Bold = true;

                        //ws.Cells[1, 30].Style.Fill.PatternType = ExcelFillStyle.Solid;
                        //ws.Cells[1, 30].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightBlue);
                        //ws.Cells[1, 30].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
                        //ws.Cells[1, 30].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                        #endregion

                        if (result.Count() > 0)
                        {
                            count = result.Count() + 2;
                            //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Value = sum;//result.Sum(x => x.TotalProbes);
                            //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Font.Bold = true;
                            //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Font.UnderLine = true;
                            //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Font.Color.SetColor(System.Drawing.Color.Blue);
                            //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Border.BorderAround(ExcelBorderStyle.Thin);
                        }

                        pkg.Workbook.Worksheets.FirstOrDefault().DefaultColWidth = 20;
                        pkg.Workbook.Worksheets.FirstOrDefault().Row(1).Height = 25;

                        // using (ExcelRange r = workSheet.Cells[startRowFrom + 1, 1, startRowFrom + dataTable.Rows.Count, dataTable.Columns.Count])
                        // var modelTable = pkg.Workbook.Worksheets.FirstOrDefault().Cells["A1:MP" + (count - 1)]; //+ (count - 1)

                        var modelTable = pkg.Workbook.Worksheets.FirstOrDefault().Cells[ws.Dimension.Start.Row, 1, ws.Dimension.Start.Row + table.Rows.Count, table.Columns.Count]; //+ (count - 1)
                        var border     = modelTable.Style.Border.Top.Style = modelTable.Style.Border.Left.Style = modelTable.Style.Border.Right.Style = modelTable.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
                        pkg.Workbook.Properties.Title = "Attempts";

                        this.Response.BinaryWrite(pkg.GetAsByteArray());
                        this.Response.End();
                    }
                } // End Export Block


                #endregion // End Probes
            }
            else
            {
                MessageBox.MessageShow(this.GetType(), "Please Choose Export Date!.", ClientScript);
            }
        }
Ejemplo n.º 10
0
        protected void btnDenoImport_Click(object sender, EventArgs e)
        {
            DateTime vSetDate, vFromDate, vToDate;

            var denochangelist = new List <DenoChangeEntity>(); // NEED 1 (first)

            if (txtImportDate.Text != "" && txtImportDate.Text != null)
            {
                if (txtImportDate.Text != "" && txtImportDateTo.Text == "")
                {
                    txtImportDateTo.Text = txtImportDate.Text;
                }


                string count = "";
                vFromDate = DateTime.ParseExact(GeneralUtility.ConvertDisplayDateStringFormat(this.txtImportDate.Text.Trim()), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                //Convert.ToDateTime(txtImportDate.Text.Trim());
                vToDate = DateTime.ParseExact(GeneralUtility.ConvertDisplayDateStringFormat(this.txtImportDateTo.Text.Trim()), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                //Convert.ToDateTime(txtImportDateTo.Text.Trim());



                if (vToDate < vFromDate)
                {
                    MessageBox.MessageShow(this.GetType(), "Invalid To Date.", ClientScript);
                    return;
                }

                vSetDate = vFromDate;

                DenoChange change = new DenoChange();
                count = change.getCountForProjectByDate(GeneralUtility.ConvertSystemDateStringFormat(vSetDate));

                //if (count == "0")
                //{
                if (FileUpload1.HasFile)
                {
                    if (Path.GetExtension(FileUpload1.FileName) == ".xlsx")
                    {
                        ExcelPackage   package   = new ExcelPackage(FileUpload1.FileContent); // NEED 2 (first)
                        ExcelWorksheet workSheet = package.Workbook.Worksheets.First();       // NEED 2 (first)
                        workSheet.DeleteRow(1);                                               // NEED 3 (first)
                        DenoChange_BindBusiness(denochangelist, workSheet);                   // NEED 4 (first)
                    }
                }

                #region Save Probes (first)

                DenoChange itemBusiness = new DenoChange();

                using (TransactionScope Scope = new TransactionScope())
                {
                    try
                    {
                        while (vSetDate <= vToDate)
                        {
                            foreach (var v in denochangelist)
                            {
                                itemBusiness.Entity = v;
                                v.DCDate            = GeneralUtility.ConvertSystemDateStringFormat(vSetDate);
                                var ID = GeneralUtility.GeneratedKey;
                                v.ID = ID;

                                var entity = itemBusiness.FindByProjectAndChangeDate(v);

                                if (entity == null)
                                {
                                    itemBusiness.Save();
                                }

                                else
                                {
                                    v.ID = entity.ID;
                                    itemBusiness.Entity = v;
                                    itemBusiness.Update();
                                }
                            }
                            vSetDate = vSetDate.AddDays(1);
                        }
                        itemBusiness.DeleteNullValue();
                        Scope.Complete();
                        MessageBox.MessageShow(this.GetType(), "Project Denominators Times For All Projects Daily Import Successfully!.", ClientScript);
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("error.aspx");
                        throw ex;
                    }
                }

                #endregion
                //}


                //else
                //{
                //    MessageBox.MessageShow(this.GetType(), "This Excel File has already been Imported!", ClientScript);
                //}
            }
            else
            {
                MessageBox.MessageShow(this.GetType(), "Please Choose Import Date!.", ClientScript);
            }
        }
Ejemplo n.º 11
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }
            using (TransactionScope scope = new TransactionScope())
            {
                if (btnSubmit.Text == "Submit")
                {
                    try
                    {
                        var userEntity = (UserEntity)Session["ID"];
                        new ProbesRate
                        {
                            Entity = new RateEntity
                            {
                                ID          = GeneralUtility.GeneratedKey,
                                Rate1       = Convert.ToDecimal(txtRate1.Text),
                                Rate2       = Convert.ToDecimal(txtRate2.Text),
                                Rate3       = Convert.ToDecimal(txtRate3.Text),
                                RatedYear   = GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim()),
                                Createdby   = userEntity.ID,
                                UpdatedBy   = userEntity.ID,
                                UpdatedDate = GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now)
                            }
                        }.Save();
                        MessageBox.MessageShow(this.GetType(), "Successfully Save.", ClientScript);
                        scope.Complete();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                else
                {
                    try
                    {
                        var userEntity = (UserEntity)Session["ID"];
                        new ProbesRate
                        {
                            Entity = new RateEntity
                            {
                                ID          = ID = hdID.Value,
                                Rate1       = Convert.ToDecimal(txtRate1.Text),
                                Rate2       = Convert.ToDecimal(txtRate2.Text),
                                Rate3       = Convert.ToDecimal(txtRate3.Text),
                                RatedYear   = GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim()),
                                Createdby   = userEntity.ID,
                                UpdatedBy   = userEntity.ID,
                                UpdatedDate = GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now),
                            }
                        }.Update();
                        MessageBox.MessageShow(this.GetType(), "Successfully Updated.", ClientScript);
                        btnSubmit.Text = "Submit";
                        scope.Complete();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            txtRate1.Text = "";
            txtRate2.Text = "";
            txtRate3.Text = "";
            txtMonth.Text = "";
            BindGrid();

            //if (btnSubmit.Text == "Submit")
            //{

            //    using (TransactionScope scope = new TransactionScope())
            //    {

            //        try
            //        {
            //            var entity = new ProbesRate().FindRate();
            //            var userEntity = (UserEntity)Session["ID"];
            //            if (entity != null)
            //            {
            //                //ID = hdID.Value;
            //                entity.Rate1 = Convert.ToInt32(txtRate1.Text);
            //                entity.Rate2 = Convert.ToInt32(txtRate2.Text);
            //                entity.Rate3 = Convert.ToInt32(txtRate3.Text);
            //                entity.RatedYear = GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim());
            //                entity.Createdby = entity.Createdby;
            //                entity.UpdatedBy = userEntity.ID;
            //                entity.UpdatedDate = GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now);
            //                var business = new ProbesRate();
            //                business.Entity = entity;
            //                business.Update();
            //                MessageBox.MessageShow(this.GetType(), "Successfully Updated.", ClientScript);
            //            }
            //            else
            //            {
            //                 //string RYear=string.Empty;
            //                 //RYear = GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim());
            //                new ProbesRate
            //                {
            //                    Entity = new RateEntity
            //                    {
            //                        ID = GeneralUtility.GeneratedKey,
            //                        Rate1 = Convert.ToInt32(txtRate1.Text),
            //                        Rate2 = Convert.ToInt32(txtRate2.Text),
            //                        Rate3 = Convert.ToInt32(txtRate3.Text),
            //                        RatedYear = GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim()),
            //                        Createdby = userEntity.ID,
            //                        UpdatedBy = userEntity.ID,
            //                        UpdatedDate = GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now)
            //                    }
            //                }.Save();
            //                MessageBox.MessageShow(this.GetType(), "Successfully Save.", ClientScript);
            //            }

            //            scope.Complete();
            //        }
            //        catch (Exception ex)
            //        {
            //            throw ex;
            //        }
            //    }
            //}

            //else
            //{
            //    MessageBox.MessageShow(this.GetType(), "Please Choose Date!.", ClientScript);
            //}
        }
        protected void btnExport_Click(object sender, EventArgs e)
        {
            if (txtMonth.Text != "" && txtMonth.Text != null)
            {
                #region "For Under 96%+5K"

                var branchcode = string.Empty;

                if (ddlCenterName.SelectedItem.Value != "All")
                {
                    branchcode = ddlCenterName.SelectedValue.ToString();
                }


                fromDate = GeneralUtility.ConvertSystemDateStringFormat(txtFromDate.Text);
                toDate   = GeneralUtility.ConvertSystemDateStringFormat(txtToDate.Text);

                string fromYear  = fromDate.Substring(0, 4);
                string fromMonth = fromDate.Substring(4, 2);

                string toYear  = toDate.Substring(0, 4);
                string toMonth = toDate.Substring(4, 2);

                if (fromYear == toYear && fromMonth == toMonth)
                {
                    Month1    = fromYear + fromMonth;
                    Month2    = string.Empty;
                    FromDate2 = string.Empty;
                    ToDate2   = string.Empty;
                }
                else
                {
                    //string comparedate = new AccuracyPercentage().FindMonthAndYear(fromDate);
                    //string comparemonth = comparedate.Substring(3, 2);
                    //string compareyear = comparedate.Substring(6, 4);

                    string   comparedate  = new AccuracyPercentage().FindMonthAndYear(fromDate);
                    DateTime fromtime     = DateTime.Parse(comparedate);
                    var      fdate        = GeneralUtility.ConvertSystemDateStringFormat(fromtime);
                    string   comparemonth = fdate.Substring(4, 2);
                    string   compareyear  = fdate.Substring(0, 4);

                    if (compareyear != toYear || comparemonth != toMonth)
                    {
                        MessageBox.MessageShow(this.GetType(), "Please Check FromDate and ToDate!.", ClientScript);
                        return;
                    }

                    Month1    = fromYear + fromMonth;
                    Month2    = compareyear + comparemonth;
                    FromDate2 = Month2 + "01";
                    ToDate2   = toDate;
                    toDate    = new AccuracyPercentage().FindLastDayOfMonth(fromDate);
                }

                int probesQty           = 7500;
                var probesqtyInfoEntity = new ProbesQty().FindQty();

                if (probesqtyInfoEntity != null)
                {
                    probesQty = probesqtyInfoEntity.Qty;
                }

                var finalAccuracyList = new AccuracyPercentage().FindByMonthForUnder96P(branchcode, Month1, probesQty, 96, fromDate, toDate, Month2, FromDate2, ToDate2);

                DataTable attTbl = new DataTable();

                attTbl.Clear();
                attTbl.Columns.Clear();

                var result = (from dd in finalAccuracyList
                              orderby dd.QAT
                              select dd).ToList();

                // Convert to DataTable.
                DataTable table = ConvertToDataTable(result);

                table.Columns.Remove("RQuality");
                //table.Columns.Remove("AmountforProbes");
                //table.Columns.Remove("AmountforAccuracy");
                //table.Columns.Remove("PPPA");
                //table.Columns.Remove("Center");
                table.Columns.Remove("Month");


                //int sum = finalProbesdt.AsEnumerable().Sum(s => s.Field<int>("Total Probes"));

                var      yrm  = GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim());
                int      yr   = Convert.ToInt32(yrm.Substring(0, 4).ToString());
                int      mth  = Convert.ToInt32(yrm.Substring(4, 2).ToString());
                DateTime date = new DateTime(yr, mth, 1);
                var      mm   = date.ToString("MMMM");
                var      yy   = date.ToString("yy");

                if (result.Count().Equals(0))
                {
                    MessageBox.MessageShow(GetType(), "No Export Data.!", ClientScript);
                }
                else
                {
                    var fileName = "AccuracyUnder96% " + mm + "'" + yy + ".xlsx";
                    int count    = 0;
                    Response.Clear();
                    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                    //Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode("Probes_List_Export.xlsx", System.Text.Encoding.UTF8));
                    this.Response.AddHeader(
                        "content-disposition",
                        string.Format("attachment;  filename={0}", fileName));

                    ExcelPackage pkg = new ExcelPackage();

                    using (pkg)
                    {
                        ExcelWorksheet ws = pkg.Workbook.Worksheets.Add("Under 96%");

                        ws.Cells["A1"].LoadFromDataTable(table, true);

                        #region "No need region"
                        // using (ExcelRange rng = ws.Cells["A1:W1"])
                        //  using (ExcelRange r = workSheet.Cells[startRowFrom, 1, startRowFrom, dataTable.Columns.Count])
                        using (ExcelRange rng = ws.Cells[1, 1, 1, table.Columns.Count])
                        {
                            rng.Style.Font.Bold = true;
                            //Set Pattern for the background to Solid
                            rng.Style.Fill.PatternType = ExcelFillStyle.Solid;
                            //Set color to dark blue
                            rng.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.FromArgb(79, 129, 189));
                            //  rng.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.FromArgb(122,160,205));
                            rng.Style.Font.Color.SetColor(System.Drawing.Color.White);
                        }

                        //string PersentageCellFormat = "#0.00%";
                        //string PersentageCellFormat = "#0.00%";
                        //using (ExcelRange Rng = ws.Cells["D2"])
                        //{
                        //    Rng.Style.Numberformat.Format = PersentageCellFormat;
                        //    // Rng.Value = Convert.ToDecimal(39.9);
                        //}

                        //ws.Cells[2, 4].Style.Numberformat.Format = "0.00\\%";

                        //   ws.Cells[2, 4].Style.Numberformat.Format = "#0.00%";
                        //   ws.Cells[2, 4].Style.Numberformat.Format = "#0\\.00%";
                        //ws.Cells["A1:MT"].Style.Font.Bold = true;
                        ////ws.Cells["A1"].Style.Font.Bold = true;
                        //using (ExcelRange rng = ws.Cells["A1:U" + (colcount - 1)])
                        //{
                        //    rng.Style.Font.Bold = true;
                        //}

                        //var headerCell = ws.Cells["A5:MT"];
                        //headerCell.Style.Fill.PatternType = ExcelFillStyle.Solid;
                        //headerCell.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.BurlyWood);
                        //var headerFont = headerCell.Style.Font;
                        //headerFont.Bold = true;

                        //ws.Cells[1, 30].Style.Fill.PatternType = ExcelFillStyle.Solid;
                        //ws.Cells[1, 30].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightBlue);
                        //ws.Cells[1, 30].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
                        //ws.Cells[1, 30].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                        #endregion

                        if (result.Count() > 0)
                        {
                            count = result.Count() + 2;
                            //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Value = sum;//result.Sum(x => x.TotalProbes);
                            //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Font.Bold = true;
                            //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Font.UnderLine = true;
                            //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Font.Color.SetColor(System.Drawing.Color.Blue);
                            //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Border.BorderAround(ExcelBorderStyle.Thin);
                        }

                        pkg.Workbook.Worksheets.FirstOrDefault().DefaultColWidth = 20;
                        pkg.Workbook.Worksheets.FirstOrDefault().Row(1).Height = 25;

                        // using (ExcelRange r = workSheet.Cells[startRowFrom + 1, 1, startRowFrom + dataTable.Rows.Count, dataTable.Columns.Count])
                        // var modelTable = pkg.Workbook.Worksheets.FirstOrDefault().Cells["A1:MP" + (count - 1)]; //+ (count - 1)

                        var modelTable = pkg.Workbook.Worksheets.FirstOrDefault().Cells[ws.Dimension.Start.Row, 1, ws.Dimension.Start.Row + table.Rows.Count, table.Columns.Count]; //+ (count - 1)
                        var border     = modelTable.Style.Border.Top.Style = modelTable.Style.Border.Left.Style = modelTable.Style.Border.Right.Style = modelTable.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
                        pkg.Workbook.Properties.Title = "Attempts";

                        this.Response.BinaryWrite(pkg.GetAsByteArray());
                        this.Response.End();
                    }
                } // End Export Block


                #endregion // End Probes
            }
            else
            {
                MessageBox.MessageShow(this.GetType(), "Please Choose Export Date!.", ClientScript);
            }
        }
Ejemplo n.º 13
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            fromDate = GeneralUtility.ConvertSystemDateStringFormat(txtFromDate.Text);
            toDate   = GeneralUtility.ConvertSystemDateStringFormat(txtToDate.Text);

            var branchcode = string.Empty;

            if (ddlCenterName.SelectedItem.Value != "All")
            {
                branchcode = ddlCenterName.SelectedValue.ToString();
            }


            var probesList = new Probes
            {
                Criteria = new PPP_Project.Criteria.ImportJobsCriteria
                {
                    CenterName = branchcode,
                    FromDate   = fromDate,
                    ToDate     = toDate,
                }
            }.FindProbesJobImportList(); // FindByCriteria(); // for Probes //

            #region "Probes"

            DataTable attTbl = new DataTable();
            attTbl.Clear();
            attTbl.Columns.Clear();


            #endregion

            var pricingprobesList = new PricingProbes
            {
                Criteria = new PPP_Project.Criteria.ImportJobsCriteria
                {
                    CenterName = branchcode,
                    FromDate   = fromDate,
                    ToDate     = toDate,
                }
            }.FindPricingProbesJobImportList(); //FindByCriteria(); // for PricingProbes

            var masksList = new Masks
            {
                Criteria = new PPP_Project.Criteria.ImportJobsCriteria
                {
                    CenterName = branchcode,
                    FromDate   = fromDate,
                    ToDate     = toDate,
                }
            }.FindMasksJobImportList();  //FindByCriteria(); // for Masks

            var votesList = new Votes
            {
                Criteria = new PPP_Project.Criteria.ImportJobsCriteria
                {
                    CenterName = branchcode,
                    FromDate   = fromDate,
                    ToDate     = toDate,
                }
            }.FindVotesJobImportList(); //FindByCriteria(); // for Votes

            var repricingList = new Repricing
            {
                Criteria = new PPP_Project.Criteria.ImportJobsCriteria
                {
                    CenterName = branchcode,
                    FromDate   = fromDate,
                    ToDate     = toDate,
                }
            }.FindRepricingJobImportList(); //FindByCriteria(); // for repricing

            var scenesList = new Scenes
            {
                Criteria = new PPP_Project.Criteria.ImportJobsCriteria
                {
                    CenterName = branchcode,
                    FromDate   = fromDate,
                    ToDate     = toDate,
                }
            }.FindScenesJobImportList(); //FindByCriteria(); // for scenes

            var scenerecognitionList = new SceneRecognition
            {
                Criteria = new PPP_Project.Criteria.ImportJobsCriteria
                {
                    CenterName = branchcode,
                    FromDate   = fromDate,
                    ToDate     = toDate,
                }
            }.FindSceneRecognitionJobImport(); //.FindByCriteria(); // for scenerecognition

            var categoryexpertList = new CategoryExpert
            {
                Criteria = new PPP_Project.Criteria.ImportJobsCriteria
                {
                    CenterName = branchcode,
                    FromDate   = fromDate,
                    ToDate     = toDate,
                }
            }.FindCategoryExpertJobImport(); //FindByCriteria(); // for categoryexpert

            #region "Currently No Need"

            //var smartstitchingList = new SmartStitching
            //{
            //    Criteria = new PPP_Project.Criteria.ImportJobsCriteria
            //    {
            //        CenterName = branchcode,
            //        FromDate = fromDate,
            //        ToDate = toDate,
            //    }
            //}.FindSmartStitchingJobImportList(); //FindByCriteria(); // for smartstitching

            //var categoryexpertvotingList = new CategoryExpertVoting
            //{
            //    Criteria = new PPP_Project.Criteria.ImportJobsCriteria
            //    {
            //        CenterName = branchcode,
            //        FromDate = fromDate,
            //        ToDate = toDate,
            //    }
            //}.FindCategoryExpertVotingJobImportList(); // for categoryexpert

            #endregion


            #region "For Probes"
            //if (ddlJobName.SelectedValue == "Probes")
            //{
            //    var probesList = new Probes
            //    {
            //        Criteria = new PPP_Project.Criteria.ImportJobsCriteria
            //        {
            //            CenterName = branchcode,
            //            FromDate = fromDate,
            //            ToDate = toDate,
            //        }

            //    }.FindByCriteria();

            //    DataTable attTbl = new DataTable();

            //    attTbl.Clear();
            //    attTbl.Columns.Clear();

            //    var result = (from dd in probesList
            //                  orderby dd.Center
            //                  select dd).ToList();

            //    // Convert to DataTable.
            //    DataTable table = ConvertToDataTable(result);

            //    //for (int i = table.Columns.Count - 1; i >= 0; i--)

            //    table.Columns.Remove(table.Columns[0]);
            //    table.Columns.Remove("TableName");

            //    if (result.Count() != 0)
            //    {
            //        for (int i = table.Columns.Count - 1; i >= 0; i--) // this is mean (table.Columns.Count - 1) last column count
            //        {
            //            DataRow row = table.Rows[table.Rows.Count - 1];
            //            //row["CreatedDate"] = GeneralUtility.ConvertDisplayDateStringFormat(Convert.ToDateTime(table.AsEnumerable().Last())); //(row["CreatedDate"]) // not good

            //            int totalRows = table.Rows.Count;
            //            int totalCols = table.Columns.Count;

            //            string value = table.Rows[totalRows - 1][totalCols - 1].ToString();

            //            for (int j = 0; j < totalRows; j++)
            //            {
            //                table.Rows[j]["CreatedDate"] = GeneralUtility.ConvertDisplayDateStringFormat(value); // this is change to String Datetime to Display String Date in DataTable

            //                table.AcceptChanges();
            //            }

            //        }
            //    }

            //    //DataTable finalProbesdt2 = table.CopyToDataTable();

            //    DataTable finalProbesdt = SupressEmptyColumns(table);

            //    //int sum = finalProbesdt.AsEnumerable().Sum(s => s.Field<int>("Total Probes"));

            //    if (result.Count().Equals(0))
            //    {
            //        MessageBox.MessageShow(GetType(), "No Export Data.!", ClientScript);
            //    }
            //    else
            //    {
            //        var fileName = "ProbesList_Export.xlsx";
            //        int count = 0;
            //        Response.Clear();
            //        Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            //        //Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode("Probes_List_Export.xlsx", System.Text.Encoding.UTF8));
            //        this.Response.AddHeader(
            //                    "content-disposition",
            //                    string.Format("attachment;  filename={0}", fileName));

            //        ExcelPackage pkg = new ExcelPackage();

            //        using (pkg)
            //        {

            //            ExcelWorksheet ws = pkg.Workbook.Worksheets.Add("Probes");

            //            ws.Cells["A1"].LoadFromDataTable(finalProbesdt, true);

            //            #region "No need region"
            //            //ws.Cells["A1:MT"].Style.Font.Bold = true;
            //            ////ws.Cells["A1"].Style.Font.Bold = true;
            //            //using (ExcelRange rng = ws.Cells["A1:U" + (colcount - 1)])
            //            //{
            //            //    rng.Style.Font.Bold = true;
            //            //}

            //            //var headerCell = ws.Cells["A5:MT"];
            //            //headerCell.Style.Fill.PatternType = ExcelFillStyle.Solid;
            //            //headerCell.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.BurlyWood);
            //            //var headerFont = headerCell.Style.Font;
            //            //headerFont.Bold = true;

            //            //ws.Cells[1, 30].Style.Fill.PatternType = ExcelFillStyle.Solid;
            //            //ws.Cells[1, 30].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightBlue);
            //            //ws.Cells[1, 30].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            //            //ws.Cells[1, 30].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            //            #endregion

            //            if (result.Count() > 0)
            //            {
            //                count = result.Count() + 2;
            //                //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Value = sum;//result.Sum(x => x.TotalProbes);
            //                //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Font.Bold = true;
            //                //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Font.UnderLine = true;
            //                //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Font.Color.SetColor(System.Drawing.Color.Blue);
            //                //    pkg.Workbook.Worksheets.FirstOrDefault().Cells[count, 3].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            //            }

            //            pkg.Workbook.Worksheets.FirstOrDefault().DefaultColWidth = 20;
            //            pkg.Workbook.Worksheets.FirstOrDefault().Row(1).Height = 25;


            //            var modelTable = pkg.Workbook.Worksheets.FirstOrDefault().Cells["A1:MP" + (count - 1)]; //+ (count - 1)
            //            var border = modelTable.Style.Border.Top.Style = modelTable.Style.Border.Left.Style = modelTable.Style.Border.Right.Style = modelTable.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
            //            pkg.Workbook.Properties.Title = "Attempts";

            //            this.Response.BinaryWrite(pkg.GetAsByteArray());
            //            this.Response.End();

            //        }

            //    } // End Probes Export Block

            //}
            #endregion // End Probes

            //MessageBox.MessageShow(this.GetType(), "Please Choose Job Name!.", ClientScript);
        }
Ejemplo n.º 14
0
        protected void btnTicTacImport_Click(object sender, EventArgs e)
        {
            //var plist = new List<TicTacEntity>(); // NEED 1 (first)
            List <string> import_successList = new List <string>();

            if (txtImportDate.Text != "" && txtImportDate.Text != null)
            {
                if (FileUpload1.HasFile)
                {
                    if (Path.GetExtension(FileUpload1.FileName) == ".xlsx")
                    {
                        #region "Multi Sheet or Sheet by Sheet Import" (third thinking => )

                        using (ExcelPackage ex_package = new ExcelPackage(FileUpload1.FileContent))
                        {
                            int ws_count = ex_package.Workbook.Worksheets.Count();

                            // if (ws_count == 1) //for (int i = 1; i <= ws_count; i++)    'Edited
                            for (int i = 1; i <= ws_count; i++)
                            {
                                //var probes_list = new List<TicTacEntity>();
                                var sheet_name = ex_package.Workbook.Worksheets[i].Name;
                                var center     = ddlCenterName.SelectedValue.ToString();

                                #region "For Tic Tac"

                                if (sheet_name.ToString().Trim() == "TIC TAC usage") //sheet_name == "Probes"
                                {
                                    var tictacs = new TicTac().FindByImportedDateAndCenter(GeneralUtility.ConvertSystemDateStringFormat(txtImportDate.Text.Trim()), center);
                                    if (tictacs.Count() == 0)
                                    {
                                        var tictacs_list = new List <TicTacEntity>();

                                        ExcelWorksheet tictac_workSheet = ex_package.Workbook.Worksheets[i];
                                        //  probes_workSheet.DeleteRow(1);

                                        if (tictac_workSheet.Dimension != null)
                                        {
                                            TicTacs_BindBusiness(tictacs_list, tictac_workSheet, center);

                                            #region Save Tic Tacs

                                            TicTac itemBusiness = new TicTac();

                                            using (TransactionScope Scope = new TransactionScope())
                                            {
                                                try
                                                {
                                                    //probes_list.RemoveAt(0);
                                                    foreach (var v in tictacs_list)
                                                    {
                                                        itemBusiness.Entity = v;
                                                        itemBusiness.Save();
                                                    }
                                                    Scope.Complete();
                                                    import_successList.Add("Tic Tacs Import Successfully!\n");
                                                    MessageBox.MessageShow(this.GetType(), "Tic Tacs Import Successfully!.", ClientScript);
                                                }
                                                catch (Exception ex)
                                                {
                                                    Response.Redirect("error.aspx");
                                                    throw ex;
                                                }
                                            }

                                            #endregion
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.MessageShow(this.GetType(), "This Excel File has already been Imported!", ClientScript);
                                    }
                                }
                                #endregion
                            }
                        }
                        #endregion
                    }
                }
            }
            else
            {
                MessageBox.MessageShow(this.GetType(), "Please Choose Import Date!.", ClientScript);
            }
        }
Ejemplo n.º 15
0
        private void Cancel_Stitching_BindBusiness(List <CancelEntity> cancellist, ExcelWorksheet ws)
        {
            var userEntity = (UserEntity)Session["ID"];

            for (var rowNumber = 1; rowNumber <= ws.Dimension.End.Row; rowNumber++)
            #region for Loop Row
            {
                var cancelEntity = new CancelEntity();

                cancelEntity.ID = GeneralUtility.GeneratedKey;

                #region Populate Excel data

                for (var colNumber = 1; colNumber <= ws.Dimension.End.Column; colNumber++)
                {
                    var columnName1 = ws.Cells[1, colNumber].Value.ToString().Trim();

                    try
                    {
                        if (true && rowNumber > 1)
                        {
                            switch (columnName1)
                            {
                                #region
                            //case 1:
                            case "user id":     //QAT
                                cancelEntity.QAT = Convert.ToString(ws.Cells[rowNumber, colNumber].Value);
                                break;

                            //case 2:
                            case "Total Deduct Count":
                                cancelEntity.Stitching = Convert.ToDecimal(ws.Cells[rowNumber, colNumber].Value);
                                break;

                                #endregion

                            default: break;

                                #endregion
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("error.aspx");
                        throw ex;
                    }
                }


                if (rowNumber > 1)
                {
                    cancelEntity.Center      = ddlCenterName.SelectedValue.ToString();
                    cancelEntity.CancelMonth = GeneralUtility.ConvertMonthYearStringFormat(txtImportDate.Text);
                    cancelEntity.CreatedDate = GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now);
                    cancelEntity.Createdby   = userEntity.ID;
                    cancellist.Add(cancelEntity);
                }


                #endregion
            }
        }
        private void Deno_BindBusiness(List <ProjectDenominatorsEntity> denolist, ExcelWorksheet ws)
        {
            var userEntity = (UserEntity)Session["ID"];

            for (var rowNumber = 1; rowNumber <= ws.Dimension.End.Row; rowNumber++)
            {
                var denoEntity = new ProjectDenominatorsEntity();

                denoEntity.ID = GeneralUtility.GeneratedKey;

                #region Populate Excel data

                for (var colNumber = 1; colNumber <= ws.Dimension.End.Column; colNumber++)
                {
                    // var columnName1 = ws.Cells[1, colNumber].Value.ToString().Trim();
                    try
                    {
                        if (true)
                        {
                            switch (colNumber)
                            {
                                #region
                            case 1:
                                denoEntity.PROJECT = Convert.ToString(ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 2:
                                denoEntity.Probes = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? 0 : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 3:
                                denoEntity.Pricingprobes = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? 0 : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 4:
                                denoEntity.Masks = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? 0 : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 5:
                                denoEntity.Repricing = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? 0 : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 6:
                                denoEntity.SceneRecog = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? 0 : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 7:
                                denoEntity.Expert = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? 0 : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 8:
                                denoEntity.ProbesperScene = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? 0 : ws.Cells[rowNumber, colNumber].Value);
                                break;
                            //case 9:
                            //    denoEntity.AMERICAS_DEMO = Convert.ToInt32(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? 0 : ws.Cells[rowNumber, colNumber].Value);
                            //    break;

                            default: break;

                                #endregion
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("error.aspx");
                        throw ex;
                    }
                }


                denoEntity.CreatedDate = GeneralUtility.ConvertSystemDateStringFormat(txtImportDate.Text.Trim());//GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now);
                denoEntity.DenoMonth   = GeneralUtility.ConvertMonthYearStringFormat(txtImportDate.Text);
                //probesEntity.ImportTime = GeneralUtility.ConvertSystemTimeFormat(System.DateTime.Now);
                denoEntity.Createdby = userEntity.ID;


                denolist.Add(denoEntity);

                #endregion
            }
        }
Ejemplo n.º 17
0
        private void TicTacs_BindBusiness(List <TicTacEntity> tictacslist, ExcelWorksheet ws, string center)
        {
            var userEntity = (UserEntity)Session["ID"];

            for (var rowNumber = 1; rowNumber <= ws.Dimension.End.Row; rowNumber++)
            #region for Loop Row
            {
                var TicTacEntity = new TicTacEntity();

                TicTacEntity.ID = GeneralUtility.GeneratedKey;

                #region Populate Excel data

                for (var colNumber = 1; colNumber <= ws.Dimension.End.Column; colNumber++)
                {
                    var columnName = ws.Cells[1, colNumber].Value.ToString().Trim();

                    try
                    {
                        if (true && rowNumber > 1)
                        {
                            switch (columnName)
                            {
                                #region
                            //case 1:
                            case "user":
                                TicTacEntity.QAT = Convert.ToString(ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case "project_name":
                                TicTacEntity.Project = Convert.ToString(ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case "Number of Tic Tacs":
                                TicTacEntity.Qty = Convert.ToInt32(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? 0 : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            default: break;


                                #endregion
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("error.aspx");
                        throw ex;
                    }
                }


                if (rowNumber > 1)
                {
                    TicTacEntity.Center     = ddlCenterName.SelectedValue.ToString();
                    TicTacEntity.TicTacDate = GeneralUtility.ConvertSystemDateStringFormat(txtImportDate.Text.Trim());//GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now);
                    TicTacEntity.TicTacYear = TicTacEntity.TicTacDate.Substring(0, 6);
                    //TicTacEntity.ImportTime = GeneralUtility.ConvertSystemTimeFormat(System.DateTime.Now);
                    TicTacEntity.CreatedBy = userEntity.ID;


                    tictacslist.Add(TicTacEntity);
                }


                #endregion
            }
            #endregion
        }
Ejemplo n.º 18
0
        private void DenoChange_BindBusiness(List <DenoChangeEntity> denochangelist, ExcelWorksheet ws)
        {
            for (var rowNumber = 1; rowNumber <= ws.Dimension.End.Row; rowNumber++)
            {
                var denochangeEntity = new DenoChangeEntity();

                // denochangeEntity.ID = GeneralUtility.GeneratedKey;

                #region Populate Excel data

                for (var colNumber = 1; colNumber <= ws.Dimension.End.Column; colNumber++)
                {
                    // var columnName1 = ws.Cells[1, colNumber].Value.ToString().Trim();
                    try
                    {
                        if (true)
                        {
                            switch (colNumber)
                            {
                                #region
                            case 1:
                                denochangeEntity.PROJECT = Convert.ToString(ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 2:
                                if (Convert.ToString(ws.Cells[rowNumber, colNumber].Value) == "0" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null)
                                {
                                    denochangeEntity.Probes = null;
                                    denochangeEntity.Votes  = null;
                                }

                                else
                                {
                                    denochangeEntity.Probes = Convert.ToDecimal(ws.Cells[rowNumber, colNumber].Value);
                                    denochangeEntity.Votes  = Convert.ToDecimal(ws.Cells[rowNumber, colNumber].Value);
                                }
                                //denochangeEntity.Probes = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? null : ws.Cells[rowNumber, colNumber].Value);
                                // denochangeEntity.Votes = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value) == "0" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? null : ws.Cells[rowNumber, colNumber].Value);
                                //  Convert.ToDecimal(
                                break;

                            case 3:
                                if (Convert.ToString(ws.Cells[rowNumber, colNumber].Value) == "0" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null)
                                {
                                    denochangeEntity.Pricingprobes = null;
                                }

                                else
                                {
                                    denochangeEntity.Pricingprobes = Convert.ToDecimal(ws.Cells[rowNumber, colNumber].Value);
                                }
                                // denochangeEntity.Pricingprobes = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? null : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 4:
                                if (Convert.ToString(ws.Cells[rowNumber, colNumber].Value) == "0" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null)
                                {
                                    denochangeEntity.Masks = null;
                                }

                                else
                                {
                                    denochangeEntity.Masks = Convert.ToDecimal(ws.Cells[rowNumber, colNumber].Value);
                                }
                                // denochangeEntity.Masks = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? null : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 5:
                                if (Convert.ToString(ws.Cells[rowNumber, colNumber].Value) == "0" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null)
                                {
                                    denochangeEntity.Repricing = null;
                                }

                                else
                                {
                                    denochangeEntity.Repricing = Convert.ToDecimal(ws.Cells[rowNumber, colNumber].Value);
                                }
                                //denochangeEntity.Repricing = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? null : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 6:
                                if (Convert.ToString(ws.Cells[rowNumber, colNumber].Value) == "0" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null)
                                {
                                    denochangeEntity.SceneRecog = null;
                                }

                                else
                                {
                                    denochangeEntity.SceneRecog = Convert.ToDecimal(ws.Cells[rowNumber, colNumber].Value);
                                }
                                // denochangeEntity.SceneRecog = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? null : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 7:
                                if (Convert.ToString(ws.Cells[rowNumber, colNumber].Value) == "0" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null)
                                {
                                    denochangeEntity.Expert       = null;
                                    denochangeEntity.ExpertVoting = null;
                                }

                                else
                                {
                                    denochangeEntity.Expert       = Convert.ToDecimal(ws.Cells[rowNumber, colNumber].Value);
                                    denochangeEntity.ExpertVoting = Convert.ToDecimal(ws.Cells[rowNumber, colNumber].Value);
                                }
                                //denochangeEntity.Expert = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? null : ws.Cells[rowNumber, colNumber].Value);
                                //denochangeEntity.ExpertVoting = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? null : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 8:
                                if (Convert.ToString(ws.Cells[rowNumber, colNumber].Value) == "0" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null)
                                {
                                    denochangeEntity.ProbesperScene = null;
                                }

                                else
                                {
                                    denochangeEntity.ProbesperScene = Convert.ToDecimal(ws.Cells[rowNumber, colNumber].Value);
                                }
                                //  denochangeEntity.ProbesperScene = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? null : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            default: break;

                                #endregion
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("error.aspx");
                        throw ex;
                    }
                }


                denochangeEntity.CreatedDate = GeneralUtility.ConvertSystemDateStringFormat(txtImportDate.Text.Trim());//GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now);
                //denochangeEntity.DCDate = GeneralUtility.ConvertSystemDateStringFormat(txtImportDate.Text.Trim());
                //probesEntity.ImportTime = GeneralUtility.ConvertSystemTimeFormat(System.DateTime.Now);
                denochangeEntity.Createdby = "admin";


                denochangelist.Add(denochangeEntity);

                #endregion
            }
        }
Ejemplo n.º 19
0
        private void Acc_BindBusiness(List <AccuracyEntity> denolist, ExcelWorksheet ws)
        {
            var userEntity = (UserEntity)Session["ID"];

            for (var rowNumber = 1; rowNumber <= ws.Dimension.End.Row; rowNumber++)
            {
                var accEntity = new AccuracyEntity();

                accEntity.ID = GeneralUtility.GeneratedKey;

                #region Populate Excel data

                for (var colNumber = 1; colNumber <= ws.Dimension.End.Column; colNumber++)
                {
                    try
                    {
                        if (true)
                        {
                            switch (colNumber)
                            {
                                #region
                            case 1:
                                accEntity.QAT = Convert.ToString(ws.Cells[rowNumber, colNumber].Value);
                                break;

                            case 2:
                                // accEntity.AccuracyPercent
                                //#REF!

                                if (Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() != "" && Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() != "-" && Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() != null && Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() != "#DIV/0!" && Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() != "#REF!")
                                {
                                    var orgPercent = ws.Cells[rowNumber, colNumber].Value.ToString().Trim(new[] { '%' });
                                    if (orgPercent == "100")
                                    {
                                        accEntity.AccuracyPercent = Convert.ToDecimal(orgPercent);
                                    }
                                    else
                                    {
                                        accEntity.AccuracyPercent = Convert.ToDecimal(orgPercent) * 100;
                                    }
                                }
                                //if (orgPercent.Length != 0 && orgPercent!="0")
                                //{
                                //    var percent= orgPercent.Substring(0, orgPercent.Length-1);
                                //    accEntity.AccuracyPercent = Convert.ToDecimal(percent);
                                //}
                                //accEntity.AccuracyPercent = Convert.ToDecimal(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "-" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? 0 : ws.Cells[rowNumber, colNumber].Value);
                                break;

                            //case 9:
                            //    denoEntity.AMERICAS_DEMO = Convert.ToInt32(Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == "" || Convert.ToString(ws.Cells[rowNumber, colNumber].Value).Trim() == null ? 0 : ws.Cells[rowNumber, colNumber].Value);
                            //    break;

                            default: break;

                                #endregion
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("error.aspx");
                        throw ex;
                    }
                }


                accEntity.CreatedDate = GeneralUtility.ConvertSystemDateStringFormat(txtImportDate.Text.Trim());//GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now);
                accEntity.AccMonth    = GeneralUtility.ConvertMonthYearStringFormat(txtImportDate.Text);
                accEntity.Center      = ddlCenterName.SelectedValue.ToString();
                //probesEntity.ImportTime = GeneralUtility.ConvertSystemTimeFormat(System.DateTime.Now);
                accEntity.Createdby = userEntity.ID;


                denolist.Add(accEntity);

                #endregion
            }
        }
Ejemplo n.º 20
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            fromDate = GeneralUtility.ConvertSystemDateStringFormat(txtFromDate.Text);
            toDate   = GeneralUtility.ConvertSystemDateStringFormat(txtToDate.Text);

            string fromYear  = fromDate.Substring(0, 4);
            string fromMonth = fromDate.Substring(4, 2);

            string toYear  = toDate.Substring(0, 4);
            string toMonth = toDate.Substring(4, 2);

            if (fromYear == toYear && fromMonth == toMonth)
            {
                Month1    = fromYear + fromMonth;
                Month2    = string.Empty;
                FromDate2 = string.Empty;
                ToDate2   = string.Empty;
            }
            else
            {
                //string comparedate = new AccuracyPercentage().FindMonthAndYear(fromDate);
                //string comparemonth = comparedate.Substring(3, 2);
                //string compareyear = comparedate.Substring(6, 4);

                string   comparedate  = new AccuracyPercentage().FindMonthAndYear(fromDate);
                DateTime fromtime     = DateTime.Parse(comparedate);
                var      date         = GeneralUtility.ConvertSystemDateStringFormat(fromtime);
                string   comparemonth = date.Substring(4, 2);
                string   compareyear  = date.Substring(0, 4);

                if (compareyear != toYear || comparemonth != toMonth)
                {
                    MessageBox.MessageShow(this.GetType(), "Please Check FromDate and ToDate!.", ClientScript);
                    return;
                }

                Month1    = fromYear + fromMonth;
                Month2    = compareyear + comparemonth;
                FromDate2 = Month2 + "01";
                ToDate2   = toDate;
                toDate    = new AccuracyPercentage().FindLastDayOfMonth(fromDate);
            }

            //(branchcode, Month1, 7500, 96, fromDate, toDate, Month2, FromDate2, ToDate2);

            var branchcode = string.Empty;

            if (ddlCenterName.SelectedItem.Value != "All")
            {
                branchcode = ddlCenterName.SelectedValue.ToString();
            }



            #region "For TicTac"

            var tictacslist = new TicTac
            {
                Criteria = new PPP_Project.Criteria.ImportJobsCriteria
                {
                    CenterName = branchcode,
                    FromDate   = fromDate,
                    ToDate     = toDate,
                    Month1     = Month1,
                    Month2     = Month2,
                    FromDate2  = FromDate2,
                    ToDate2    = ToDate2,
                }
            }.FindByCriteriaDenominatorForTicTacs();

            DataTable attTbl = new DataTable();

            attTbl.Clear();
            attTbl.Columns.Clear();

            var result = (from dd in tictacslist
                          orderby dd.Center
                          select dd).ToList();

            // Convert to DataTable.
            DataTable table = ConvertToDataTable(result);



            DataTable finalProbesdt = SupressEmptyColumnsForDenominator(table);



            var      yrm   = GeneralUtility.ConvertSystemDateStringFormat(txtFromDate.Text.Trim());
            int      yr    = Convert.ToInt32(yrm.Substring(0, 4).ToString());
            int      mth   = Convert.ToInt32(yrm.Substring(4, 2).ToString());
            DateTime date1 = new DateTime(yr, mth, 1);
            var      mm    = date1.ToString("MMMM");
            var      yy    = date1.ToString("yy");

            if (result.Count().Equals(0))
            {
                MessageBox.MessageShow(GetType(), "No Export Data.!", ClientScript);
            }
            else
            {
                var fileName = "tictacslist_" + mm + "'" + yy + ".xlsx";
                int count    = 0;
                Response.Clear();
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                //Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode("Probes_List_Export.xlsx", System.Text.Encoding.UTF8));
                this.Response.AddHeader(
                    "content-disposition",
                    string.Format("attachment;  filename={0}", fileName));

                ExcelPackage pkg = new ExcelPackage();

                using (pkg)
                {
                    ExcelWorksheet ws = pkg.Workbook.Worksheets.Add("Probes");

                    ws.Cells["A1"].LoadFromDataTable(finalProbesdt, true);

                    #region "No need region"
                    using (ExcelRange rng = ws.Cells[1, 1, 1, finalProbesdt.Columns.Count])
                    {
                        rng.Style.Font.Bold = true;
                        //Set Pattern for the background to Solid
                        rng.Style.Fill.PatternType = ExcelFillStyle.Solid;
                        //Set color to dark blue
                        rng.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.FromArgb(79, 129, 189));
                        //  rng.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.FromArgb(122,160,205));
                        rng.Style.Font.Color.SetColor(System.Drawing.Color.White);
                    }

                    #endregion

                    if (result.Count() > 0)
                    {
                        count = result.Count() + 2;
                    }

                    pkg.Workbook.Worksheets.FirstOrDefault().DefaultColWidth = 20;
                    pkg.Workbook.Worksheets.FirstOrDefault().Row(1).Height = 25;



                    var modelTable = pkg.Workbook.Worksheets.FirstOrDefault().Cells[ws.Dimension.Start.Row, 1, ws.Dimension.Start.Row + table.Rows.Count, table.Columns.Count];     //+ (count - 1)
                    var border     = modelTable.Style.Border.Top.Style = modelTable.Style.Border.Left.Style = modelTable.Style.Border.Right.Style = modelTable.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
                    pkg.Workbook.Properties.Title = "Attempts";

                    this.Response.BinaryWrite(pkg.GetAsByteArray());
                    this.Response.End();
                }
            }


            #endregion // End Probes
        }
Ejemplo n.º 21
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (!ValidateForm())
     {
         return;
     }
     using (TransactionScope scope = new TransactionScope())
     {
         if (btnSubmit.Text == "Submit")
         {
             try
             {
                 var userEntity = (UserEntity)Session["ID"];
                 new AccuracyPercentRate
                 {
                     Entity = new AccPerRateEntity
                     {
                         ID              = GeneralUtility.GeneratedKey,
                         AccPerRate1     = Convert.ToInt32(txtAccPercentRate1.Text),
                         AccPerRate2     = Convert.ToInt32(txtAccPercentRate2.Text),
                         AccPerRate3     = Convert.ToInt32(txtAccPercentRate3.Text),
                         AccPerRatedYear = GeneralUtility.ConvertMonthYearStringFormat(txtAccPerMonth.Text.Trim()),
                         Createdby       = userEntity.ID,
                         UpdatedBy       = userEntity.ID,
                         UpdatedDate     = GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now)
                     }
                 }.Save();
                 MessageBox.MessageShow(this.GetType(), "Successfully Save.", ClientScript);
                 scope.Complete();
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         }
         else
         {
             try
             {
                 var userEntity = (UserEntity)Session["ID"];
                 new AccuracyPercentRate
                 {
                     Entity = new AccPerRateEntity
                     {
                         ID              = ID = hdID.Value,
                         AccPerRate1     = Convert.ToInt32(txtAccPercentRate1.Text),
                         AccPerRate2     = Convert.ToInt32(txtAccPercentRate2.Text),
                         AccPerRate3     = Convert.ToInt32(txtAccPercentRate3.Text),
                         AccPerRatedYear = GeneralUtility.ConvertMonthYearStringFormat(txtAccPerMonth.Text.Trim()),
                         Createdby       = userEntity.ID,
                         UpdatedBy       = userEntity.ID,
                         UpdatedDate     = GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now),
                     }
                 }.Update();
                 MessageBox.MessageShow(this.GetType(), "Successfully Updated.", ClientScript);
                 btnSubmit.Text = "Submit";
                 scope.Complete();
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         }
     }
     txtAccPercentRate1.Text = "";
     txtAccPercentRate2.Text = "";
     txtAccPercentRate3.Text = "";
     txtAccPerMonth.Text     = "";
     BindGrid();
 }
Ejemplo n.º 22
0
        private void Update_Submit(DateTime vFromDate, DateTime vToDate, DateTime vSetDate)
        {
            try
            {
                var userEntity          = (UserEntity)Session["ID"];
                ProjectDenominators dc2 = new ProjectDenominators();
                string projectname      = ddlPROJECT.SelectedValue.ToString();
                string multiplydate     = GeneralUtility.ConvertSystemDateStringFormat(txtDcDate.Text.Trim()).Substring(0, 6);
                //decimal multiply = Convert.ToDecimal(txtDcTimes.Text);

                DBReader <DenoChangeEntity> dr = new DBReader <DenoChangeEntity>();
                string DcID = dr.ExcuteScalar("Select ID From DenoChange Where Project = '" + projectname + "' And DCDate = '" + GeneralUtility.ConvertSystemDateStringFormat(vSetDate) + "'", null, ConnectionDAO.Client.ToConnectionString()).ToString();

                string DChangeDate = GeneralUtility.ConvertSystemDateStringFormat(txtDcDate.Text.Trim());
                System.Nullable <Decimal> probesvalue;
                System.Nullable <Decimal> pricingprobesvalue;
                System.Nullable <Decimal> votesvalue;
                System.Nullable <Decimal> masksvalue;
                System.Nullable <Decimal> repricingvalue;
                System.Nullable <Decimal> scenerecogvalue;
                System.Nullable <Decimal> probesperscenevalue;
                System.Nullable <Decimal> expertvalue;
                System.Nullable <Decimal> expertvotingvalue;
                if (txtProbes.Text != "" && txtProbes.Text != "0")
                {
                    probesvalue = Convert.ToDecimal(txtProbes.Text);
                }

                else
                {
                    probesvalue = null;
                }

                if (txtPricingProbes.Text != "" && txtPricingProbes.Text != "0")
                {
                    pricingprobesvalue = Convert.ToDecimal(txtPricingProbes.Text);
                }

                else
                {
                    pricingprobesvalue = null;
                }

                if (txtVotes.Text != "" && txtVotes.Text != "0")
                {
                    votesvalue = Convert.ToDecimal(txtVotes.Text);
                }

                else
                {
                    votesvalue = null;
                }

                if (txtMasks.Text != "" && txtMasks.Text != "0")
                {
                    masksvalue = Convert.ToDecimal(txtMasks.Text);
                }

                else
                {
                    masksvalue = null;
                }


                if (txtRepricing.Text != "" && txtRepricing.Text != "0")
                {
                    repricingvalue = Convert.ToDecimal(txtRepricing.Text);
                }

                else
                {
                    repricingvalue = null;
                }

                if (txtSceneRecog.Text != "" && txtSceneRecog.Text != "0")
                {
                    scenerecogvalue = Convert.ToDecimal(txtSceneRecog.Text);
                }

                else
                {
                    scenerecogvalue = null;
                }

                if (txtScenes.Text != "" && txtScenes.Text != "0")
                {
                    probesperscenevalue = Convert.ToDecimal(txtScenes.Text);
                }

                else
                {
                    probesperscenevalue = null;
                }

                if (txtCategoryExpert.Text != "" && txtCategoryExpert.Text != "0")
                {
                    expertvalue = Convert.ToDecimal(txtCategoryExpert.Text);
                }

                else
                {
                    expertvalue = null;
                }

                if (txtExpertVoting.Text != "" && txtExpertVoting.Text != "0")
                {
                    expertvotingvalue = Convert.ToDecimal(txtExpertVoting.Text);
                }

                else
                {
                    expertvotingvalue = null;
                }

                while (vSetDate <= vToDate)
                {
                    new DenoChange
                    {
                        Entity = new DenoChangeEntity
                        {
                            ID             = DcID,
                            PROJECT        = projectname,
                            DCDate         = GeneralUtility.ConvertSystemDateStringFormat(vSetDate),
                            Probes         = probesvalue,
                            Pricingprobes  = pricingprobesvalue,
                            Votes          = votesvalue,
                            Masks          = masksvalue,
                            Repricing      = repricingvalue,
                            SceneRecog     = scenerecogvalue,
                            ProbesperScene = probesperscenevalue,
                            Expert         = expertvalue,
                            ExpertVoting   = expertvotingvalue,
                            //Probes = Convert.ToDecimal(string.IsNullOrEmpty(txtProbes.Text) ? "0" : txtProbes.Text),
                            //Pricingprobes = Convert.ToDecimal(string.IsNullOrEmpty(txtPricingProbes.Text) ? "0" : txtPricingProbes.Text),
                            //Votes = Convert.ToDecimal(string.IsNullOrEmpty(txtVotes.Text) ? "0" : txtVotes.Text),
                            //Masks = Convert.ToDecimal(string.IsNullOrEmpty(txtMasks.Text) ? "0" : txtMasks.Text),
                            //Repricing = Convert.ToDecimal(string.IsNullOrEmpty(txtRepricing.Text) ? "0" : txtRepricing.Text),
                            //SceneRecog = Convert.ToDecimal(string.IsNullOrEmpty(txtSceneRecog.Text) ? "0" : txtSceneRecog.Text),
                            //ProbesperScene = Convert.ToDecimal(string.IsNullOrEmpty(txtScenes.Text) ? "0" : txtScenes.Text),
                            //Expert = Convert.ToDecimal(string.IsNullOrEmpty(txtCategoryExpert.Text) ? "0" : txtCategoryExpert.Text),
                            Createdby   = userEntity.ID,
                            UpdatedBy   = userEntity.ID,
                            UpdatedDate = GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now),
                        }
                    }.Update();
                    vSetDate = vSetDate.AddDays(1);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 23
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DateTime vSetDate, vFromDate, vToDate;

            if (!ValidateForm())
            {
                return;
            }

            if (txtDcDate.Text != "" && txtDcDateTo.Text == "")
            {
                txtDcDateTo.Text = txtDcDate.Text;
            }

            using (TransactionScope scope = new TransactionScope())
            {
                if (btnSubmit.Text == "Submit")
                {
                    try
                    {
                        var userEntity             = (UserEntity)Session["ID"];
                        ProjectDenominators dc     = new ProjectDenominators();
                        DenoChange          change = new DenoChange();
                        string projectname         = ddlPROJECT.SelectedValue.ToString();
                        string multiplydate        = GeneralUtility.ConvertSystemDateStringFormat(txtDcDate.Text.Trim()).Substring(0, 6);
                        string count = "";
                        System.Nullable <Decimal> probesvalue;
                        System.Nullable <Decimal> pricingprobesvalue;
                        System.Nullable <Decimal> votesvalue;
                        System.Nullable <Decimal> masksvalue;
                        System.Nullable <Decimal> repricingvalue;
                        System.Nullable <Decimal> scenerecogvalue;
                        System.Nullable <Decimal> probesperscenevalue;
                        System.Nullable <Decimal> expertvalue;
                        System.Nullable <Decimal> expertvotingvalue;

                        //vFromDate = Convert.ToDateTime(txtDcDate.Text.Trim());
                        //vToDate = Convert.ToDateTime(txtDcDateTo.Text.Trim());

                        vFromDate = DateTime.ParseExact(GeneralUtility.ConvertDisplayDateStringFormat(this.txtDcDate.Text.Trim()), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        //Convert.ToDateTime(GeneralUtility.ConvertDisplayDateStringFormat(txtDcDate.Text.Trim()));
                        vToDate = DateTime.ParseExact(GeneralUtility.ConvertDisplayDateStringFormat(this.txtDcDateTo.Text.Trim()), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        //Convert.ToDateTime(GeneralUtility.ConvertDisplayDateStringFormat(txtDcDateTo.Text.Trim()));

                        vSetDate = vFromDate;

                        while (vSetDate <= vToDate)
                        {
                            count = change.getCountForProject(projectname, GeneralUtility.ConvertSystemDateStringFormat(vSetDate));
                            if (count == "0")
                            {
                                if (txtProbes.Text != "" && txtProbes.Text != "0")
                                {
                                    probesvalue = Convert.ToDecimal(txtProbes.Text);
                                }

                                else
                                {
                                    probesvalue = null;
                                }

                                if (txtPricingProbes.Text != "" && txtPricingProbes.Text != "0")
                                {
                                    pricingprobesvalue = Convert.ToDecimal(txtPricingProbes.Text);
                                }

                                else
                                {
                                    pricingprobesvalue = null;
                                }

                                if (txtVotes.Text != "" && txtVotes.Text != "0")
                                {
                                    votesvalue = Convert.ToDecimal(txtVotes.Text);
                                }

                                else
                                {
                                    votesvalue = null;
                                }

                                if (txtMasks.Text != "" && txtMasks.Text != "0")
                                {
                                    masksvalue = Convert.ToDecimal(txtMasks.Text);
                                }

                                else
                                {
                                    masksvalue = null;
                                }


                                if (txtRepricing.Text != "" && txtRepricing.Text != "0")
                                {
                                    repricingvalue = Convert.ToDecimal(txtRepricing.Text);
                                }

                                else
                                {
                                    repricingvalue = null;
                                }

                                if (txtSceneRecog.Text != "" && txtSceneRecog.Text != "0")
                                {
                                    scenerecogvalue = Convert.ToDecimal(txtSceneRecog.Text);
                                }

                                else
                                {
                                    scenerecogvalue = null;
                                }

                                if (txtScenes.Text != "" && txtScenes.Text != "0")
                                {
                                    probesperscenevalue = Convert.ToDecimal(txtScenes.Text);
                                }

                                else
                                {
                                    probesperscenevalue = null;
                                }

                                if (txtCategoryExpert.Text != "" && txtCategoryExpert.Text != "0")
                                {
                                    expertvalue = Convert.ToDecimal(txtCategoryExpert.Text);
                                }

                                else
                                {
                                    expertvalue = null;
                                }

                                if (txtExpertVoting.Text != "" && txtExpertVoting.Text != "0")
                                {
                                    expertvotingvalue = Convert.ToDecimal(txtExpertVoting.Text);
                                }

                                else
                                {
                                    expertvotingvalue = null;
                                }



                                new DenoChange
                                {
                                    Entity = new DenoChangeEntity
                                    {
                                        ID             = GeneralUtility.GeneratedKey,
                                        PROJECT        = ddlPROJECT.SelectedValue.ToString(),
                                        DCDate         = GeneralUtility.ConvertSystemDateStringFormat(vSetDate),
                                        Probes         = probesvalue,
                                        Pricingprobes  = pricingprobesvalue,
                                        Votes          = votesvalue,
                                        Masks          = masksvalue,
                                        Repricing      = repricingvalue,
                                        SceneRecog     = scenerecogvalue,
                                        ProbesperScene = probesperscenevalue,
                                        Expert         = expertvalue,
                                        ExpertVoting   = expertvotingvalue,


                                        // Probes = Convert.ToDecimal(string.IsNullOrEmpty(txtProbes.Text) ? "0" : txtProbes.Text),
                                        //Pricingprobes = Convert.ToDecimal(string.IsNullOrEmpty(txtPricingProbes.Text) ? "0" : txtPricingProbes.Text),
                                        //Votes = Convert.ToDecimal(string.IsNullOrEmpty(txtVotes.Text) ? "0" : txtVotes.Text),
                                        //Masks = Convert.ToDecimal(string.IsNullOrEmpty(txtMasks.Text) ? "0" : txtMasks.Text),
                                        //Repricing = Convert.ToDecimal(string.IsNullOrEmpty(txtRepricing.Text) ? "0" : txtRepricing.Text),
                                        //SceneRecog = Convert.ToDecimal(string.IsNullOrEmpty(txtSceneRecog.Text) ? "0" : txtSceneRecog.Text),
                                        //ProbesperScene = Convert.ToDecimal(string.IsNullOrEmpty(txtScenes.Text) ? "0" : txtScenes.Text),
                                        //Expert = Convert.ToDecimal(string.IsNullOrEmpty(txtCategoryExpert.Text) ? "0" : txtCategoryExpert.Text),
                                        //Probes = Convert.ToDecimal(dc.getDenominatorForProject(projectname, multiplydate, multiply, "Probes")),
                                        //Pricingprobes = Convert.ToDecimal(dc.getDenominatorForProject(projectname, multiplydate, multiply, "Pricingprobes")),
                                        //Masks = Convert.ToDecimal(dc.getDenominatorForProject(projectname, multiplydate, multiply, "Masks")),
                                        //Repricing = Convert.ToDecimal(dc.getDenominatorForProject(projectname, multiplydate, multiply, "Repricing")),
                                        //SceneRecog = Convert.ToDecimal(dc.getDenominatorForProject(projectname, multiplydate, multiply, "SceneRecog")),
                                        //ProbesperScene = Convert.ToDecimal(dc.getDenominatorForProject(projectname, multiplydate, multiply, "ProbesperScene")),
                                        //Expert = Convert.ToDecimal(dc.getDenominatorForProject(projectname, multiplydate, multiply, "Expert")),
                                        Createdby   = userEntity.ID,
                                        UpdatedBy   = userEntity.ID,
                                        UpdatedDate = GeneralUtility.ConvertSystemDateStringFormat(System.DateTime.Now),
                                    }
                                }.Save();
                            }
                            else
                            {
                                //MessageBox.MessageShow(this.GetType(), "This Project already exits in '" + vSetDate.ToString("dd-MMM-yyyy") + "'! This date will be skipped!", ClientScript);

                                Update_Submit(vSetDate, vSetDate, vSetDate);
                            }

                            vSetDate = vSetDate.AddDays(1);
                        }

                        MessageBox.MessageShow(this.GetType(), "Successfully Save.", ClientScript);
                        scope.Complete();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                else
                {
                    try
                    {
                        vFromDate = DateTime.ParseExact(GeneralUtility.ConvertDisplayDateStringFormat(this.txtDcDate.Text.Trim()), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        //Convert.ToDateTime(GeneralUtility.ConvertDisplayDateStringFormat(txtDcDate.Text.Trim()));
                        vToDate = DateTime.ParseExact(GeneralUtility.ConvertDisplayDateStringFormat(this.txtDcDateTo.Text.Trim()), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        //Convert.ToDateTime(GeneralUtility.ConvertDisplayDateStringFormat(txtDcDateTo.Text.Trim()));
                        //Convert.ToDateTime(txtDcDateTo.Text.Trim());

                        vSetDate = vFromDate;

                        Update_Submit(vFromDate, vToDate, vSetDate);

                        //  MessageBox.MessageShow(this.GetType(), "Successfully Updated.", ClientScript);
                        //  btnSubmit.Text = "Submit";
                        string msg = "Successfully Updated.";
                        scope.Complete();

                        if (!string.IsNullOrEmpty(hdID.Value))
                        {
                            ScriptManager.RegisterStartupScript(this, this.GetType(),
                                                                "alert",
                                                                "alert('" + msg + "');window.location ='ProjectDenominatorList.aspx';",
                                                                true);
                        }
                        else
                        {
                            MessageBox.MessageShow(this.GetType(), msg, ClientScript);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            this.hdID.Value          = string.Empty;
            ddlPROJECT.SelectedValue = "Select";
            txtDcDate.Text           = "";
            txtDcDateTo.Text         = "";
            txtProbes.Text           = "";
            txtPricingProbes.Text    = "";
            txtVotes.Text            = "";
            txtMasks.Text            = "";
            txtRepricing.Text        = "";
            txtScenes.Text           = "";
            txtSceneRecog.Text       = "";
            txtCategoryExpert.Text   = "";
            txtExpertVoting.Text     = "";
            BindGrid();
        }