Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtFromDate.Text = GeneralUtility.ConvertDisplayDateStringFormat(System.DateTime.Now);
                txtToDate.Text   = GeneralUtility.ConvertDisplayDateStringFormat(System.DateTime.Now);

                var Probes = new Probes();
                var result = Probes.FindAllBranch();

                ddlCenterName.Items.Insert(0, "All");
                for (int i = 0; i < result.Count; i++)
                {
                    ddlCenterName.Items.Insert(i + 1, new ListItem(result[i].BranchName, result[i].BranchCode));
                }

                #region "Not Used"
                //var Probes = new Probes();
                //var result = Probes.Finds().Select(x => x.Center).Distinct().ToList();

                //ddlCenterName.Items.Insert(0, "All");
                //for (int i = 0; i < result.Count; i++)
                //{
                //    ddlCenterName.Items.Insert(i + 1, new ListItem(result[i], result[i]));
                //}
                #endregion
            }
        }
        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();
        }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BindPROJECT();
         if (!IsPostBack)
         {
             BindGrid();
         }
         string sPROJECT = Request.QueryString["PROJECT"];
         if (!string.IsNullOrEmpty(sPROJECT))
         {
             hdID.Value = sPROJECT;
             string     id       = hdID.Value.ToString();
             DenoChange business = new DenoChange();
             var        entity   = business.FindDataByID(id);
             if (entity != null)
             {
                 this.ddlPROJECT.SelectedValue = entity.PROJECT;
                 this.txtProbes.Text           = entity.Probes.ToString();
                 this.txtPricingProbes.Text    = entity.Pricingprobes.ToString();
                 this.txtVotes.Text            = entity.Votes.ToString();
                 this.txtMasks.Text            = entity.Masks.ToString();
                 this.txtRepricing.Text        = entity.Repricing.ToString();
                 this.txtScenes.Text           = entity.ProbesperScene.ToString();
                 this.txtSceneRecog.Text       = entity.SceneRecog.ToString();
                 this.txtCategoryExpert.Text   = entity.Expert.ToString();
                 this.txtExpertVoting.Text     = entity.ExpertVoting.ToString();
                 this.txtDcDate.Text           = GeneralUtility.ConvertDisplayDateStringFormat(entity.DCDate);
                 this.txtDcDateTo.Text         = GeneralUtility.ConvertDisplayDateStringFormat(entity.DCDate);
             }
             btnSubmit.Text = "Update";
         }
     }
 }
Beispiel #4
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();
     }
 }
        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();
            }
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtFromDate.Text = GeneralUtility.ConvertDisplayDateStringFormat(System.DateTime.Now);
                txtToDate.Text   = GeneralUtility.ConvertDisplayDateStringFormat(System.DateTime.Now);

                var Probes = new Probes();
                var result = Probes.FindAllBranch();

                ddlCenterName.Items.Insert(0, "All");
                for (int i = 0; i < result.Count; i++)
                {
                    ddlCenterName.Items.Insert(i + 1, new ListItem(result[i].BranchName, result[i].BranchCode));
                }
            }
        }
Beispiel #7
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();
                }
            }
        }
Beispiel #8
0
        protected void gvDenoChange_SelectedIndexChanged(object sender, EventArgs e)
        {
            hdID.Value = gvDenoChange.SelectedRow.Cells[0].Text;
            string     id       = hdID.Value.ToString();
            DenoChange business = new DenoChange();
            var        entity   = business.FindDataByID(id);

            if (entity != null)
            {
                this.ddlPROJECT.SelectedValue = entity.PROJECT;
                this.txtProbes.Text           = entity.Probes.ToString();
                this.txtPricingProbes.Text    = entity.Pricingprobes.ToString();
                this.txtVotes.Text            = entity.Votes.ToString();
                this.txtMasks.Text            = entity.Masks.ToString();
                this.txtRepricing.Text        = entity.Repricing.ToString();
                this.txtScenes.Text           = entity.ProbesperScene.ToString();
                this.txtSceneRecog.Text       = entity.SceneRecog.ToString();
                this.txtCategoryExpert.Text   = entity.Expert.ToString();
                this.txtExpertVoting.Text     = entity.ExpertVoting.ToString();
                this.txtDcDate.Text           = GeneralUtility.ConvertDisplayDateStringFormat(entity.DCDate);
                this.txtDcDateTo.Text         = GeneralUtility.ConvertDisplayDateStringFormat(entity.DCDate);
            }
            btnSubmit.Text = "Update";
        }
        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);
            }
        }
        private void BindGrid()
        {
            gvRecheckAcc.Columns[0].Visible = true;
            AccuracyPercentage Pbusiness = new AccuracyPercentage();
            var    list  = Pbusiness.Finds();
            string month = GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim());

            //string currentMonth=month.Substring(0, 6);
            list = list.Where(x => x.AccMonth == month && x.QAT == ddlQAT.SelectedValue).ToList();
            var reslist = from data in list
                          select new { data.ID, data.QAT, data.AccuracyPercent, data.Center, AccMonth = GeneralUtility.ConvertDisplayMonthStringFormat(data.AccMonth), CreatedDate = GeneralUtility.ConvertDisplayDateStringFormat(data.CreatedDate), data.Createdby };

            gvRecheckAcc.DataSource = reslist.ToList();
            gvRecheckAcc.DataBind();
            gvRecheckAcc.Columns[0].Visible = false;
            //gvRecheckAcc.Columns[4].Visible = false;
            gvRecheckAcc.Columns[5].Visible = false;
            gvRecheckAcc.Columns[6].Visible = false;
        }
Beispiel #11
0
        private void BindGrid()
        {
            gvProbesRate.Columns[0].Visible = true;
            ProbesRate Pbusiness = new ProbesRate();
            var        list      = Pbusiness.Find();
            var        reslist   = from data in list
                                   select new { data.ID, data.Rate1, data.Rate2, data.Rate3, RatedYear = GeneralUtility.ConvertDisplayMonthStringFormat(data.RatedYear), CreatedDate = GeneralUtility.ConvertDisplayDateStringFormat(data.CreatedDate), data.Createdby };

            gvProbesRate.DataSource            = reslist.ToList();
            gvProbesRate.Columns[1].HeaderText = Pbusiness.getRangeLabel(1);
            gvProbesRate.Columns[2].HeaderText = Pbusiness.getRangeLabel(2);
            gvProbesRate.Columns[3].HeaderText = Pbusiness.getRangeLabel(3);
            gvProbesRate.DataBind();

            gvProbesRate.Columns[0].Visible = false;
            gvProbesRate.Columns[5].Visible = false;
            gvProbesRate.Columns[6].Visible = false;
        }
        private void BindGrid()
        {
            gvDenoChange.Columns[0].Visible = true;
            ProjectDenominators Pbusiness = new ProjectDenominators();
            var    list  = Pbusiness.Find();
            string month = GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim());

            if (ddlPROJECT.SelectedValue != "All")
            {
                list = list.Where(x => x.DenoMonth == month && x.PROJECT == ddlPROJECT.SelectedValue).ToList();
            }
            else
            {
                list = list.Where(x => x.DenoMonth == month).ToList();
            }

            var reslist = from data in list
                          select new { data.ID, data.PROJECT, data.Probes, data.Pricingprobes, data.Masks, data.Repricing, data.SceneRecog, data.ProbesperScene, data.Expert, DenoMonth = GeneralUtility.ConvertDisplayMonthStringFormat(data.DenoMonth), CreatedDate = GeneralUtility.ConvertDisplayDateStringFormat(data.CreatedDate), data.Createdby };

            gvDenoChange.DataSource = reslist.ToList();
            gvDenoChange.DataBind();
            gvDenoChange.Columns[0].Visible  = false;
            gvDenoChange.Columns[10].Visible = false;
            gvDenoChange.Columns[11].Visible = false;
        }
Beispiel #13
0
        private void BindGrid()
        {
            gvAccPerRate.Columns[0].Visible = true;
            AccuracyPercentRate Pbusiness = new AccuracyPercentRate();
            var list    = Pbusiness.Find();
            var reslist = from data in list
                          select new { data.ID, data.AccPerRate1, data.AccPerRate2, data.AccPerRate3, AccPerRatedYear = GeneralUtility.ConvertDisplayMonthStringFormat(data.AccPerRatedYear), CreatedDate = GeneralUtility.ConvertDisplayDateStringFormat(data.CreatedDate), data.Createdby };

            gvAccPerRate.DataSource = reslist.ToList();
            gvAccPerRate.DataBind();
            gvAccPerRate.Columns[0].Visible = false;
            gvAccPerRate.Columns[5].Visible = false;
            gvAccPerRate.Columns[6].Visible = false;
        }
        private void BindGrid()
        {
            gvDenoChange.Columns[0].Visible = true;
            DenoChange Pbusiness = new DenoChange();
            var        list      = Pbusiness.Find();
            var        reslist   = from data in list
                                   select new { data.ID, data.PROJECT, data.Probes, data.Pricingprobes, data.Votes, data.Masks, data.Repricing, data.SceneRecog, data.ProbesperScene, data.Expert, data.ExpertVoting, DCDate = GeneralUtility.ConvertDisplayDateStringFormat(data.DCDate), CreatedDate = GeneralUtility.ConvertDisplayDateStringFormat(data.CreatedDate), data.Createdby };

            reslist = this.ddlPROJECT.SelectedItem.Text == "All" ? reslist : reslist.Where(x => x.PROJECT == this.ddlPROJECT.SelectedValue).ToList();
            gvDenoChange.DataSource = reslist.ToList();
            gvDenoChange.DataBind();
            gvDenoChange.Columns[0].Visible  = false;
            gvDenoChange.Columns[12].Visible = false;
            gvDenoChange.Columns[13].Visible = false;
        }
Beispiel #15
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();
        }
Beispiel #16
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);
            }
        }