Beispiel #1
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";
         }
     }
 }
        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)
            {
                Response.Redirect("ProjectDenominatorsChanges.aspx?PROJECT=" + id);
            }
        }
Beispiel #3
0
        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 };

            gvDenoChange.DataSource = reslist.ToList();
            gvDenoChange.DataBind();
            gvDenoChange.Columns[0].Visible  = false;
            gvDenoChange.Columns[12].Visible = false;
            gvDenoChange.Columns[13].Visible = false;
        }
Beispiel #4
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";
        }
Beispiel #5
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 #6
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);
            }
        }