Exemple #1
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";
        }
Exemple #2
0
        void InitLogin()
        {
            // Hide button login
            loginButton.gameObject.SetActive(false);

            // Show log out
            logOutButton.gameObject.SetActive(true);

            // Show player name
            userName.gameObject.SetActive(true);
            userName.text = AccountManager.Instance.GetDisplayName();

            // Download avatar
            avatar.gameObject.SetActive(true);
            Debug.Log("AvatarUrl:" + AccountManager.Instance.GetAvatarUrl());
            if (!string.IsNullOrEmpty(AccountManager.Instance.GetAvatarUrl()))
            {
                StartCoroutine(GeneralUtility.GetTextureFromUrlAsync(AccountManager.Instance.GetAvatarUrl(), ShowAvatar));
            }
            else
            {
                avatar.sprite = dummySprite;
            }
        }
Exemple #3
0
    public void getOrgInfo(int orgAcct, ref string orgName, ref string orgInfo, ref int term)
    {
        SQL = "SELECT * from organization WHERE elt_account_number = " + elt_account_number + " and org_account_number = " + orgAcct;

        DataTable dt = new DataTable();

        try
        {
            SqlDataAdapter ad = new SqlDataAdapter(SQL, Con);
            ad.Fill(dt);

            GeneralUtility util = new GeneralUtility();
            util.removeNull(ref dt);
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["owner_mail_address"].ToString() != "")
                {
                    orgName = dt.Rows[0]["dba_name"].ToString();
                    orgInfo = dt.Rows[0]["dba_name"].ToString() + "\n" + dt.Rows[0]["owner_mail_address"].ToString() + dt.Rows[0]["owner_mail_address2"].ToString() + dt.Rows[0]["owner_mail_address3"].ToString() + ",";
                    orgInfo = orgInfo + dt.Rows[0]["owner_mail_city"].ToString() + ",";
                    orgInfo = orgInfo + dt.Rows[0]["owner_mail_state"].ToString() + dt.Rows[0]["owner_mail_zip"].ToString();
                    orgInfo = orgInfo + "\n Tel:" + dt.Rows[0]["business_phone"].ToString();
                    orgInfo = orgInfo + "\n Fax:" + dt.Rows[0]["business_fax"].ToString();
                    term    = Int32.Parse(dt.Rows[0]["bill_term"].ToString());
                }
                else
                {
                    getOrgNameInfo(orgAcct, ref orgName, ref orgInfo, ref term);
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
        public void CanValidateModelTest()
        {
            // Arrange
            var projectNote = TestFramework.TestProjectNote.Create();

            // Inducing errors in projectNote
            projectNote.Note = null;
            var viewModel  = new EditNoteViewModel(projectNote.Note);
            var nameOfNote = GeneralUtility.NameOf(() => viewModel.Note);

            ICollection <ValidationResult> validationResults;

            // Act
            DataAnnotationsValidator.TryValidate(viewModel, out validationResults);

            // Assert
            Assert.That(validationResults.Count, Is.EqualTo(1), "Expecting certain number of errors");
            TestFramework.AssertFieldRequired(validationResults, nameOfNote);

            // Act
            // Set string fields to string longer than their max lengths
            viewModel.Note = TestFramework.MakeTestNameLongerThan(nameOfNote, Models.ProjectNote.FieldLengths.Note);
            DataAnnotationsValidator.TryValidate(viewModel, out validationResults);

            // Assert
            Assert.That(validationResults.Count, Is.EqualTo(1), "Expecting certain number of errors");
            TestFramework.AssertFieldStringLength(validationResults, nameOfNote, Models.ProjectNote.FieldLengths.Note);

            // Act
            // Happy path
            viewModel.Note = TestFramework.MakeTestName(nameOfNote, Models.ProjectNote.FieldLengths.Note);
            var isValid = DataAnnotationsValidator.TryValidate(viewModel, out validationResults);

            // Assert
            Assert.That(isValid, Is.True, "Should pass validation");
        }
Exemple #5
0
        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;
        }
Exemple #6
0
        public async Task <IActionResult> ResetUserPassword(string id)
        {
            var randomNewPassword = "";

            if (string.IsNullOrEmpty(id))
            {
                return(View("Index").WithAlertMessage("111", "Reset password request could not be processed."));
            }
            var rowId = _encryptionService.DecryptString(id);
            var user  = await _userManager.FindByIdAsync(rowId);

            if (user != null)
            {
                var resetResult = await _userManager.GeneratePasswordResetTokenAsync(user);

                randomNewPassword = GeneralUtility.RandomPassword();
                var result = await _userManager.ResetPasswordAsync(user, resetResult, randomNewPassword);
            }
            else
            {
                return(View("Index").WithAlertMessage(ResponseConstant.ErrorCode, "Password reset failed. User didn't exist."));
            }
            return(View("Index").WithAlertMessage(ResponseConstant.SuccessCode, "User password has been reset successfully. The new password is " + randomNewPassword));
        }
        /// <summary>
        /// Gets the models.
        /// </summary>
        /// <param name="make">The make.</param>
        /// <param name="partial">The partial.</param>
        /// <returns></returns>
        static public IEnumerable <string> GetModels(string make, string partial)
        {
            string query;

            if (!string.IsNullOrEmpty(partial))
            {
                query =
                    string.Format(
                        "select AUTO_MAKE_MODEL_ID, YEAR, MAKE, MODEL from AUTO_MAKE_MODEL where MAKE = :make and MODEL like '{0}%' ORDER BY MODEL",
                        partial.ToUpper());
            }
            else
            {
                query = "select AUTO_MAKE_MODEL_ID, YEAR, MAKE, MODEL from AUTO_MAKE_MODEL where MAKE = :make ORDER BY MODEL";
            }
            var makes = new AutoMakeModels
            {
                Query = query
            };

            makes.AddParameter("make", make.ToUpper());

            return(makes.Results().Select(a => GeneralUtility.ToTitleCase(a.Model)).Distinct().ToArray());
        }
        public void GenerateTableDefinition()
        {
            var def = new TableDefinition(DbBaseClass.SEDP)
            {
                TableName = "CLAIMNUMBERASSIGNMENTRULE"
            };

            Assert.IsTrue(def.Execute(), def.LastError);

            foreach (TableDefinition row in def)
            {
                var response = new StringBuilder();
                response.AppendFormat("columns.Add(new Column(\"{0}\", string.Empty,\"{1}\"));",
                                      row.ColumnName, row.DataType);
                //response.AppendFormat("ColumnNameMap.Add(\"{0}\",{1});\r\n", row.ColumnName, index++);
                Console.WriteLine(response);
            }
            Console.WriteLine();
            Console.WriteLine();
            def.Reset();

            foreach (TableDefinition row in def)
            {
                var response = new StringBuilder();
                response.AppendFormat("#region {0}\r\n", GeneralUtility.PascalCase(row.ColumnName));
                response.AppendLine("/// <summary>");
                response.AppendFormat("/// {0}\r\n", row.ColumnName);
                response.AppendLine("/// </summary>");
                response.AppendFormat("public string {0}\n\r{{\n\r\tget {{", GeneralUtility.PascalCase(row.ColumnName));
                response.AppendFormat(" return GetColumnValue(\"{0}\"); ", row.ColumnName);
                response.Append("}\r\n\tset {");
                response.AppendFormat(" SetColumnValue(\"{0}\",value); ", row.ColumnName);
                response.Append("}\r\n}\r\n#endregion\r\n");
                Console.WriteLine(response);
            }
        }
Exemple #9
0
    public int getNextEntryNo(int customer_acct)
    {
        int next_entry = 0;

        SQL = "select max(entry_no) as entry_no from customer_credit_info where elt_account_number = " + elt_account_number + " and customer_no=" + customer_acct;
        DataTable            dt    = new DataTable();
        SqlDataAdapter       ad    = new SqlDataAdapter(SQL, Con);
        customerCreditRecord cCRec = new customerCreditRecord();
        GeneralUtility       gUtil = new GeneralUtility();

        if (dt.Rows.Count > 0)
        {
            try
            {
                ad.Fill(dt);
                next_entry = Int32.Parse(dt.Rows[0]["entry_no"].ToString());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        return(next_entry + 1);
    }
        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);
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                BindGrid();
                return;
            }
            using (TransactionScope scope = new TransactionScope())
            {
                if (btnSubmit.Text != "Search")
                {
                    try
                    {
                        var userEntity = (UserEntity)Session["ID"];
                        AccuracyPercentage Pbusiness = new AccuracyPercentage();
                        var entity = Pbusiness.FindDataByID(hdID.Value);
                        if (entity != null)
                        {
                            new AccuracyPercentage
                            {
                                Entity = new AccuracyEntity
                                {
                                    ID              = hdID.Value,
                                    QAT             = hdQAT.Value,
                                    Center          = hdCenter.Value,
                                    AccuracyPercent = Convert.ToDecimal(txtAccuracy.Text),
                                    AccMonth        = GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim()),
                                    Createdby       = userEntity.ID,
                                }
                            }.Update();
                        }

                        MessageBox.MessageShow(this.GetType(), "Successfully Updated.", ClientScript);
                        btnSubmit.Text = "Search";
                        divAccuracy.Attributes.Add("style", "display:none");
                        BindGrid();
                        scope.Complete();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                else
                {
                    try
                    {
                        BindGrid();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }

            ddlQAT.Enabled        = true;
            ddlCenterName.Enabled = true;
            ddlQAT.SelectedValue  = "Select";
            ddlQAT.SelectedIndex  = 0;
            txtAccuracy.Text      = "";
            txtMonth.Text         = "";
        }
        public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            var identity = new ClaimsIdentity(context.Options.AuthenticationType);

            // authenticat from database
            string[] strScope          = context.Scope[0].ToString().Split(',');
            string   strSecondPassword = strScope[0];
            string   strAreaCode       = strScope[1];
            int      intClientVersion  = Convert.ToInt32(strScope[2].Replace(".", ""));
            string   LoginFromAppName  = strScope[3];
            User     FoundUser         = QccasttUtility.FindUser(context.UserName, context.Password, strSecondPassword, strAreaCode, "");

            FoundUser.ClientVersion = strScope[2].ToString();
            if (FoundUser != null)
            {
                string QCAreatSrl      = FoundUser.QCAREATSRL.ToString();
                string ValidQCAreaCode = FoundUser.AREACODE.ToString();
                if (!string.IsNullOrEmpty(ValidQCAreaCode))
                {
                    if (!string.IsNullOrEmpty(QCAreatSrl))
                    {
                        identity.AddClaim(new Claim("UserName", context.UserName));
                        identity.AddClaim(new Claim("UserId", FoundUser.USERID.ToString()));
                        identity.AddClaim(new Claim("FName", FoundUser.FNAME));
                        identity.AddClaim(new Claim("LName", FoundUser.LNAME));
                        identity.AddClaim(new Claim("srl", FoundUser.SRL.ToString()));
                        identity.AddClaim(new Claim("QCAreatSrl", FoundUser.QCAREATSRL.ToString()));
                        identity.AddClaim(new Claim("AreaCode", FoundUser.AREACODE.ToString()));
                        identity.AddClaim(new Claim("AreaDesc", FoundUser.AREADESC.ToString()));
                        identity.AddClaim(new Claim("CheckDest", FoundUser.CHECKDEST.ToString()));
                        identity.AddClaim(new Claim("AreaType", FoundUser.AREATYPE.ToString()));
                        identity.AddClaim(new Claim("MacIsValid", "true"));
                        //--- per
                        identity.AddClaim(new Claim("QCMobAppPer", FoundUser.QCMOBAPPPER.ToString()));
                        identity.AddClaim(new Claim("PTDashPer", FoundUser.PTDASHPER.ToString()));
                        identity.AddClaim(new Claim("QCDashPer", FoundUser.QCDASHPER.ToString()));
                        identity.AddClaim(new Claim("AuditDashPer", FoundUser.AUDITDASHPER.ToString()));
                        identity.AddClaim(new Claim("AuditUnLockPer", FoundUser.AUDITUNLOCKPER.ToString()));
                        identity.AddClaim(new Claim("QCRegDefPer", FoundUser.QCREGDEFPER.ToString()));
                        identity.AddClaim(new Claim("SMSQCPer", FoundUser.SMSQCPER.ToString()));
                        identity.AddClaim(new Claim("SMSAuditPer", FoundUser.SMSAUDITPER.ToString()));
                        identity.AddClaim(new Claim("SMSSPPer", FoundUser.SMSSPPER.ToString()));
                        identity.AddClaim(new Claim("QCCardPer", FoundUser.QCCARDPER.ToString()));
                        identity.AddClaim(new Claim("SMSPTPer", FoundUser.SMSPTPER.ToString()));
                        identity.AddClaim(new Claim("AuditCardPer", FoundUser.AUDITCARDPER.ToString()));
                        identity.AddClaim(new Claim("CarStatusPer", FoundUser.CARSTATUSPER.ToString()));
                        identity.AddClaim(new Claim("AppName", LoginFromAppName));
                        identity.AddClaim(new Claim("ClientVersion", strScope[2]));
                        // ---
                        if (LoginFromAppName == "qcm")
                        {
                            int ClientForceVersion = Convert.ToInt32(clsCommon.ClientForceVersion_qcmobapp.Replace(".", ""));
                            if (intClientVersion >= ClientForceVersion)
                            {
                                identity.AddClaim(new Claim("ClientVerIsValid", "true"));
                            }
                            else
                            {
                                identity.AddClaim(new Claim("ClientVerIsValid", "false"));
                            }
                            identity.AddClaim(new Claim("UserAuthorization", "true"));
                            context.Validated(identity);
                        }
                        else if (LoginFromAppName == "ins")
                        {
                            int InspectorClientForceVersion = Convert.ToInt32(clsCommon.InspectorClientForceVersion_inspector.Replace(".", ""));
                            if (intClientVersion >= InspectorClientForceVersion)
                            {
                                identity.AddClaim(new Claim("ClientVerIsValid", "true"));
                            }
                            else
                            {
                                identity.AddClaim(new Claim("ClientVerIsValid", "false"));
                            }
                            identity.AddClaim(new Claim("UserAuthorization", "true"));
                            context.Validated(identity);
                        }
                        GeneralUtility.UpdateUserData(FoundUser, null, 0);
                    }
                    else
                    {
                        context.SetError("invalid_grant_areacode", "Area access is not allowed for the user");
                        return;
                    }
                }
                else
                {
                    context.SetError("invalid_areacode", "Provided areacode is incorrect");
                    return;
                }
            }
            else
            {
                context.SetError("invalid_grant", "Provided username and password is incorrect");
                return;
            }
        }
        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);
            }
        }
Exemple #14
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);
            //}
        }
Exemple #15
0
 public override void Execute()
 {
     InitializeOutputValues();
     CopyrightInfo = GeneralUtility.GetCopyrightInfo(ControllerClassName);
     ProcessControllerTemplateOptions();
 }
        private List <string> GetShufflingResult()
        {
            try
            {
                int iPrizeSequence;
                var iShufflingColumns  = 3;
                var oPrizeType         = _model.Campaign.PrizeType.ToEnum <Enumerations.PrizeType>();
                var sStoreName         = _model.Campaign.StoreName;
                var lstShufflingResult = new List <string>();
                var dicShufflingItems  = GetShufflingItems();

                switch (oPrizeType)
                {
                case Enumerations.PrizeType.None:
                    iPrizeSequence = 0;
                    break;

                case Enumerations.PrizeType.Double:
                    iPrizeSequence = 2;
                    break;

                case Enumerations.PrizeType.Triple:
                    iPrizeSequence = 3;
                    break;

                default:
                    iPrizeSequence = 0;
                    break;
                }

                for (var iCount = 1; iCount <= iPrizeSequence; iCount++)
                {
                    lstShufflingResult.Add(dicShufflingItems[sStoreName]);
                }

                while (true)
                {
                    if (lstShufflingResult.Count.Equals(iShufflingColumns))
                    {
                        break;
                    }

                    var sRandomImage = GeneralUtility.GetDictionaryRandomItems(dicShufflingItems).Take(1).ToList().ElementAt(0);

                    if (!lstShufflingResult.Contains(sRandomImage))
                    {
                        lstShufflingResult.Add(sRandomImage);
                    }
                }

                if (iPrizeSequence > 0 && iPrizeSequence < iShufflingColumns)
                {
                    GeneralUtility.Shuffle(lstShufflingResult);
                }

                return(lstShufflingResult);
            }
            catch (Exception ex)
            {
                LogUtility.Log(LogUtility.LogType.SystemError, MethodBase.GetCurrentMethod().Name, ex.Message);

                if (OnStepErrorEventHandler != null)
                {
                    OnStepErrorEventHandler(AppConfigUtility.sMessageGenericInvoiceError);
                }
            }

            return(null);
        }
Exemple #17
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;
        }
Exemple #18
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);
        }
Exemple #19
0
        private string GetHealthCheckResultsAsPerformanceDataLong()
        {
            var allHealtCheckStatuses = GeneralUtility.EnumGetValues <HealthCheckStatus>();

            return(string.Join(" ", allHealtCheckStatuses.Select(GetHealthCheckResultsAsPerformanceDataLongPerStatus)));
        }
Exemple #20
0
 public override bool OnBeginRecipe(object currentValue, out object newValue)
 {
     newValue = GeneralUtility.GetListofFiles(ExtJsClassType.Store);
     return(true);
 }
Exemple #21
0
    public ARNRecord getARNRecord(int invoice_no, string iType)
    {
        SQL = " select * from import_hawb where elt_account_number = "
              + elt_account_number + " and invoice_no=" + invoice_no + " and iType='" + iType + "'";
        DataTable            dt     = new DataTable();
        SqlDataAdapter       ad     = new SqlDataAdapter(SQL, Con);
        customerCreditRecord cCRec  = new customerCreditRecord();
        GeneralUtility       gUtil  = new GeneralUtility();
        ARNRecord            ARNRec = new ARNRecord();

        try
        {
            ad.Fill(dt);
            gUtil.removeNull(ref dt);

            if (dt.Rows.Count > 0)
            {
                ARNRec.arr_code           = dt.Rows[0]["arr_code"].ToString();
                ARNRec.arr_port           = dt.Rows[0]["arr_port"].ToString();
                ARNRec.broker_info        = dt.Rows[0]["broker_info"].ToString();
                ARNRec.broker_name        = dt.Rows[0]["broker_name"].ToString();
                ARNRec.cargo_location     = dt.Rows[0]["cargo_location"].ToString();
                ARNRec.consignee_info     = dt.Rows[0]["consignee_info"].ToString();
                ARNRec.consignee_name     = dt.Rows[0]["consignee_name"].ToString();
                ARNRec.container_location = dt.Rows[0]["container_location"].ToString();
                ARNRec.CreatedBy          = dt.Rows[0]["CreatedBy"].ToString();
                ARNRec.CreatedDate        = dt.Rows[0]["CreatedDate"].ToString();
                ARNRec.customer_ref       = dt.Rows[0]["customer_ref"].ToString();
                ARNRec.delivery_place     = dt.Rows[0]["delivery_place"].ToString();
                ARNRec.dep_code           = dt.Rows[0]["dep_code"].ToString();
                ARNRec.dep_port           = dt.Rows[0]["dep_port"].ToString();
                ARNRec.desc1           = dt.Rows[0]["desc1"].ToString();
                ARNRec.desc2           = dt.Rows[0]["desc2"].ToString();
                ARNRec.desc3           = dt.Rows[0]["desc3"].ToString();
                ARNRec.desc4           = dt.Rows[0]["desc4"].ToString();
                ARNRec.desc5           = dt.Rows[0]["desc5"].ToString();
                ARNRec.destination     = dt.Rows[0]["destination"].ToString();
                ARNRec.eta             = dt.Rows[0]["eta"].ToString();
                ARNRec.eta2            = dt.Rows[0]["eta2"].ToString();
                ARNRec.etd             = dt.Rows[0]["etd"].ToString();
                ARNRec.etd2            = dt.Rows[0]["etd2"].ToString();
                ARNRec.flt_no          = dt.Rows[0]["flt_no"].ToString();
                ARNRec.free_date       = dt.Rows[0]["free_date"].ToString();
                ARNRec.go_date         = dt.Rows[0]["go_date"].ToString();
                ARNRec.hawb_num        = dt.Rows[0]["hawb_num"].ToString();
                ARNRec.igSub_HAWB      = dt.Rows[0]["igSub_HAWB"].ToString();
                ARNRec.is_default_rate = dt.Rows[0]["is_default_rate"].ToString();
                ARNRec.is_org_merged   = dt.Rows[0]["is_org_merged"].ToString();
                ARNRec.it_date         = dt.Rows[0]["it_date"].ToString();
                ARNRec.it_entry_port   = dt.Rows[0]["it_entry_port"].ToString();
                ARNRec.it_number       = dt.Rows[0]["it_number"].ToString();
                ARNRec.iType           = dt.Rows[0]["iType"].ToString();
                ARNRec.mawb_num        = dt.Rows[0]["mawb_num"].ToString();
                ARNRec.ModifiedBy      = dt.Rows[0]["ModifiedBy"].ToString();
                ARNRec.ModifiedDate    = dt.Rows[0]["ModifiedDate"].ToString();
                ARNRec.notify_info     = dt.Rows[0]["notify_info"].ToString();
                ARNRec.notify_name     = dt.Rows[0]["notify_name"].ToString();
                ARNRec.prepaid_collect = dt.Rows[0]["prepaid_collect"].ToString();
                ARNRec.prepared_by     = dt.Rows[0]["prepared_by"].ToString();
                ARNRec.process_dt      = dt.Rows[0]["process_dt"].ToString();
                ARNRec.processed       = dt.Rows[0]["processed"].ToString();

                ARNRec.remarks      = dt.Rows[0]["remarks"].ToString();
                ARNRec.SalesPerson  = dt.Rows[0]["SalesPerson"].ToString();
                ARNRec.scale1       = dt.Rows[0]["scale1"].ToString();
                ARNRec.shipper_info = dt.Rows[0]["shipper_info"].ToString();
                ARNRec.shipper_name = dt.Rows[0]["shipper_name"].ToString();
                ARNRec.sub_mawb1    = dt.Rows[0]["sub_mawb1"].ToString();
                ARNRec.sub_mawb2    = dt.Rows[0]["sub_mawb2"].ToString();
                ARNRec.tran_dt      = dt.Rows[0]["tran_dt"].ToString();
                ARNRec.uom          = dt.Rows[0]["uom"].ToString();
                ARNRec.scale2       = dt.Rows[0]["scale2"].ToString();

                ARNRec.pickup_date = dt.Rows[0]["pickup_date"].ToString();

                ARNRec.term           = Int32.Parse(dt.Rows[0]["term"].ToString());
                ARNRec.agent_elt_acct = Int32.Parse(dt.Rows[0]["agent_elt_acct"].ToString());
                ARNRec.agent_org_acct = Int32.Parse(dt.Rows[0]["agent_org_acct"].ToString());
                //ARNRec.arn_no = Int32.Parse(dt.Rows[0]["arn_no"].ToString());
                ARNRec.broker_acct    = Int32.Parse(dt.Rows[0]["broker_acct"].ToString());
                ARNRec.consignee_acct = Int32.Parse(dt.Rows[0]["consignee_acct"].ToString());
                ARNRec.invoice_no     = Int32.Parse(dt.Rows[0]["invoice_no"].ToString());
                ARNRec.shipper_acct   = Int32.Parse(dt.Rows[0]["shipper_acct"].ToString());
                ARNRec.sec            = Int32.Parse(dt.Rows[0]["sec"].ToString());
                ARNRec.notify_acct    = Int32.Parse(dt.Rows[0]["notify_acct"].ToString());

                ARNRec.chg_wt             = Decimal.Parse(dt.Rows[0]["chg_wt"].ToString());
                ARNRec.fc_charge          = Decimal.Parse(dt.Rows[0]["fc_charge"].ToString());
                ARNRec.fc_rate            = Decimal.Parse(dt.Rows[0]["fc_rate"].ToString());
                ARNRec.freight_collect    = Decimal.Parse(dt.Rows[0]["freight_collect"].ToString());
                ARNRec.gross_wt           = Decimal.Parse(dt.Rows[0]["gross_wt"].ToString());
                ARNRec.oc_collect         = Decimal.Parse(dt.Rows[0]["oc_collect"].ToString());
                ARNRec.pieces             = Decimal.Parse(dt.Rows[0]["pieces"].ToString());
                ARNRec.total_other_charge = Decimal.Parse(dt.Rows[0]["total_other_charge"].ToString());
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
        }
        return(ARNRec);
    }
Exemple #22
0
    public void replaceQuote()
    {
        GeneralUtility gUtil = new GeneralUtility();

        customer_name = gUtil.replaceQuote(customer_name);
    }
        public async Task <IActionResult> CampaignPayment(CustomerPaymentViewModel payment)
        {
            var user = await GetCurrentUserAsync();

            try
            {
                List <CountryViewModel> countryList = GetCountryList();
                payment.countries = countryList;
                payment.yearList  = GeneralUtility.GetYeatList();
                if (!ModelState.IsValid)
                {
                    return(View(payment));
                }

                var customerService = new StripeCustomerService(_stripeSettings.Value.SecretKey);
                var donation        = _campaignService.GetById(payment.DonationId);

                // Construct payment
                if (string.IsNullOrEmpty(user.StripeCustomerId))
                {
                    StripeCustomerCreateOptions customer = GetCustomerCreateOptions(payment, user);
                    var stripeCustomer = customerService.Create(customer);
                    user.StripeCustomerId = stripeCustomer.Id;
                }
                else
                {
                    //Check for existing credit card, if new credit card number is same as exiting credit card then we delete the existing
                    //Credit card information so new card gets generated automatically as default card.
                    //try
                    //{
                    //    var ExistingCustomer = customerService.Get(user.StripeCustomerId);
                    //    if (ExistingCustomer.Sources != null && ExistingCustomer.Sources.TotalCount > 0 && ExistingCustomer.Sources.Data.Any())
                    //    {
                    //        var cardService = new StripeCardService(_stripeSettings.Value.SecretKey);
                    //        foreach (var cardSource in ExistingCustomer.Sources.Data)
                    //        {
                    //            cardService.Delete(user.StripeCustomerId, cardSource.Card.Id);
                    //        }
                    //    }
                    //}
                    //catch (Exception ex)
                    //{
                    //    log = new EventLog() { EventId = (int)LoggingEvents.INSERT_ITEM, LogLevel = LogLevel.Error.ToString(), Message = ex.Message, StackTrace = ex.StackTrace, Source = ex.Source, EmailId = user.Email };
                    //    _loggerService.SaveEventLogAsync(log);
                    //    return RedirectToAction("Error", "Error500", new ErrorViewModel() { Error = ex.Message });
                    //}

                    StripeCustomerUpdateOptions customer = GetCustomerUpdateOption(payment);
                    try
                    {
                        var stripeCustomer = customerService.Update(user.StripeCustomerId, customer);
                        user.StripeCustomerId = stripeCustomer.Id;
                    }
                    catch (StripeException ex)
                    {
                        log = new EventLog()
                        {
                            EventId = (int)LoggingEvents.GET_CUSTOMER, LogLevel = LogLevel.Error.ToString(), Message = ex.Message, StackTrace = ex.StackTrace, Source = ex.Source, EmailId = user.Email
                        };
                        _loggerService.SaveEventLogAsync(log);
                        if (ex.Message.ToLower().Contains("customer"))
                        {
                            return(RedirectToAction("Error", "Error500", new ErrorViewModel()
                            {
                                Error = ex.Message
                            }));
                        }
                        else
                        {
                            ModelState.AddModelError("error", _localizer[ex.Message]);
                            return(View(payment));
                        }
                    }
                }

                UpdateUserEmail(payment, user);
                await UpdateUserDetail(payment, user);

                // Add customer to Stripe
                if (EnumInfo <PaymentCycle> .GetValue(donation.CycleId) == PaymentCycle.OneTime)
                {
                    var model   = (DonationViewModel)donation;
                    var charges = new StripeChargeService(_stripeSettings.Value.SecretKey);

                    // Charge the customer
                    var charge = charges.Create(new StripeChargeCreateOptions
                    {
                        Amount              = Convert.ToInt32(donation.DonationAmount * 100),
                        Description         = DonationCaption,
                        Currency            = "usd",//payment.Currency.ToLower(),
                        CustomerId          = user.StripeCustomerId,
                        StatementDescriptor = _stripeSettings.Value.StatementDescriptor,
                    });

                    if (charge.Paid)
                    {
                        var completedMessage = new CompletedViewModel
                        {
                            Message          = donation.DonationAmount.ToString(),
                            HasSubscriptions = false
                        };
                        return(RedirectToAction("Thanks", completedMessage));
                    }
                    return(RedirectToAction("Error", "Error", new ErrorViewModel()
                    {
                        Error = "Error"
                    }));
                }

                // Add to existing subscriptions and charge
                donation.Currency = "usd"; //payment.Currency;
                var plan = _campaignService.GetOrCreatePlan(donation);

                var subscriptionService = new StripeSubscriptionService(_stripeSettings.Value.SecretKey);
                var result = subscriptionService.Create(user.StripeCustomerId, plan.Id);
                if (result != null)
                {
                    CompletedViewModel completedMessage = new CompletedViewModel();
                    completedMessage = GetSubscriptionMessage(result, true);
                    return(RedirectToAction("Thanks", completedMessage));
                }
            }
            catch (StripeException ex)
            {
                log = new EventLog()
                {
                    EventId = (int)LoggingEvents.INSERT_ITEM, LogLevel = LogLevel.Error.ToString(), Message = ex.Message, StackTrace = ex.StackTrace, Source = ex.Source, EmailId = user.Email
                };
                _loggerService.SaveEventLogAsync(log);
                if (ex.Message.ToLower().Contains("customer"))
                {
                    return(RedirectToAction("Error", "Error500", new ErrorViewModel()
                    {
                        Error = ex.Message
                    }));
                }
                else
                {
                    ModelState.AddModelError("error", ex.Message);
                    return(View(payment));
                }
            }
            catch (Exception ex)
            {
                log = new EventLog()
                {
                    EventId = (int)LoggingEvents.INSERT_ITEM, LogLevel = LogLevel.Error.ToString(), Message = ex.Message, StackTrace = ex.StackTrace, Source = ex.Source, EmailId = user.Email
                };
                _loggerService.SaveEventLogAsync(log);
                return(RedirectToAction("Error", "Error", new ErrorViewModel()
                {
                    Error = ex.Message
                }));
            }
            return(RedirectToAction("Error", "Error", new ErrorViewModel()
            {
                Error = "Error"
            }));
        }
        public EditProjectCustomGridViewModel(int projectCustomGridTypeID, List <ProjectCustomGridConfiguration> projectCustomGridConfigurations, List <GeospatialAreaType> geospatialAreaTypes, List <ProjectFirmaModels.Models.ProjectCustomAttributeType> projectCustomAttributeTypes)
        {
            var projectCustomGridConfigurationSimples = new List <ProjectCustomGridConfigurationSimple>();
            var projectCustomGridColumns = GeneralUtility.EnumGetValues <ProjectCustomGridColumnEnum>();

            // Remove the Secondary Taxonomy Leaf Column if Tenant doesn't use them
            if (!MultiTenantHelpers.GetTenantAttributeFromCache().EnableSecondaryProjectTaxonomyLeaf)
            {
                projectCustomGridColumns = projectCustomGridColumns.Where(x => x != ProjectCustomGridColumnEnum.SecondaryTaxonomyLeaf).ToList();
            }
            // Remove the Project Status Column if Tenant doesn't use the timeline and status updates
            if (!MultiTenantHelpers.GetTenantAttributeFromCache().EnableStatusUpdates)
            {
                projectCustomGridColumns = projectCustomGridColumns.Where(x => x != ProjectCustomGridColumnEnum.ProjectStatus).ToList();
            }
            // Remove the Final Status Update Status Column if Tenant doesn't use the require submitting lessons learned
            if (!MultiTenantHelpers.GetTenantAttributeFromCache().EnableStatusUpdates)
            {
                projectCustomGridColumns = projectCustomGridColumns.Where(x => x != ProjectCustomGridColumnEnum.FinalStatusUpdateStatus).ToList();
            }
            // Remove the Project Type Column if Tenant doesn't use the attribute
            if (!MultiTenantHelpers.GetTenantAttributeFromCache().EnableProjectCategories)
            {
                projectCustomGridColumns = projectCustomGridColumns.Where(x => x != ProjectCustomGridColumnEnum.ProjectCategory).ToList();
            }
            // Remove Performance Measure Columns if Tenant doesn't Track Accomplishments
            if (!MultiTenantHelpers.TrackAccomplishments())
            {
                projectCustomGridColumns = projectCustomGridColumns.Where(x => x != ProjectCustomGridColumnEnum.NumberOfExpectedPerformanceMeasureRecords).ToList();
                projectCustomGridColumns = projectCustomGridColumns.Where(x => x != ProjectCustomGridColumnEnum.NumberOfReportedPerformanceMeasures).ToList();
            }
            // Remove Solicitation Column if Tenant doesn't have solicitations
            if (!MultiTenantHelpers.HasSolicitations())
            {
                projectCustomGridColumns = projectCustomGridColumns.Where(x => x != ProjectCustomGridColumnEnum.Solicitation).ToList();
            }

            foreach (var projectCustomGridColumn in projectCustomGridColumns)
            {
                if (projectCustomGridColumn == ProjectCustomGridColumnEnum.CustomAttribute)
                {
                    foreach (var projectCustomAttributeType in projectCustomAttributeTypes)
                    {
                        var enabled   = projectCustomGridConfigurations.Any(x => x.ProjectCustomGridTypeID == projectCustomGridTypeID && x.ProjectCustomGridColumnID == (int)projectCustomGridColumn && x.ProjectCustomAttributeTypeID == projectCustomAttributeType.ProjectCustomAttributeTypeID && x.IsEnabled);
                        var sortOrder = projectCustomGridConfigurations.SingleOrDefault(x => x.ProjectCustomGridTypeID == projectCustomGridTypeID && x.ProjectCustomGridColumnID == (int)projectCustomGridColumn && x.ProjectCustomAttributeTypeID == projectCustomAttributeType.ProjectCustomAttributeTypeID && x.IsEnabled)?.SortOrder;
                        projectCustomGridConfigurationSimples.Add(new ProjectCustomGridConfigurationSimple(projectCustomGridTypeID, ProjectCustomGridColumn.ToType(projectCustomGridColumn), projectCustomAttributeType, null, enabled, sortOrder));
                    }
                }

                else if (projectCustomGridColumn == ProjectCustomGridColumnEnum.GeospatialAreaName)
                {
                    foreach (var geospatialAreaType in geospatialAreaTypes)
                    {
                        var enabled   = projectCustomGridConfigurations.Any(x => x.ProjectCustomGridTypeID == projectCustomGridTypeID && x.ProjectCustomGridColumnID == (int)projectCustomGridColumn && x.GeospatialAreaTypeID == geospatialAreaType.GeospatialAreaTypeID && x.IsEnabled);
                        var sortOrder = projectCustomGridConfigurations.SingleOrDefault(x => x.ProjectCustomGridTypeID == projectCustomGridTypeID && x.ProjectCustomGridColumnID == (int)projectCustomGridColumn && x.GeospatialAreaTypeID == geospatialAreaType.GeospatialAreaTypeID && x.IsEnabled)?.SortOrder;
                        projectCustomGridConfigurationSimples.Add(new ProjectCustomGridConfigurationSimple(projectCustomGridTypeID, ProjectCustomGridColumn.ToType(projectCustomGridColumn), null, geospatialAreaType, enabled, sortOrder));
                    }
                }

                else
                {
                    var enabled   = projectCustomGridConfigurations.Any(x => x.ProjectCustomGridTypeID == projectCustomGridTypeID && x.ProjectCustomGridColumnID == (int)projectCustomGridColumn && x.IsEnabled);
                    var sortOrder = projectCustomGridConfigurations.SingleOrDefault(x => x.ProjectCustomGridTypeID == projectCustomGridTypeID && x.ProjectCustomGridColumnID == (int)projectCustomGridColumn && x.IsEnabled)?.SortOrder;
                    projectCustomGridConfigurationSimples.Add(new ProjectCustomGridConfigurationSimple(projectCustomGridTypeID, ProjectCustomGridColumn.ToType(projectCustomGridColumn), null, null, enabled, sortOrder));
                }
            }
            ProjectCustomGridConfigurationSimples = projectCustomGridConfigurationSimples;
        }
        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;
        }
Exemple #26
0
 private void pnlTituloForm_MouseDown(object sender, MouseEventArgs e)
 {
     GeneralUtility.Form_MouseDown();
     GeneralUtility.SendMessage(this.Handle, 0x112, 0xf012, 0);
 }
 public override bool IsEnabledFor(object target)
 {
     return(GeneralUtility.IsTemplateEnabledFor(target, ExtJsClassType.Controller.ToString(), GetService <DTE>(true)));
 }
Exemple #28
0
 private void frmListaEmpleados_MouseDown(object sender, MouseEventArgs e)
 {
     GeneralUtility.Form_MouseDown();
     GeneralUtility.SendMessage(this.Handle, 0x112, 0xf012, 0);
 }
Exemple #29
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            if (txtMonth.Text != "" && txtMonth.Text != null)
            {
                #region "For Project Name Not In Project Denominator"

                var projectNameList = new ProjectNames().FindByProjectName(GeneralUtility.ConvertMonthYearStringFormat(txtMonth.Text.Trim()), ddlJobName.SelectedValue);

                DataTable attTbl = new DataTable();

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

                var result = (from dd in projectNameList
                              orderby dd.PROJECT
                              select dd).ToList();

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

                table.Columns.Remove("ID");
                table.Columns.Remove("Createdby");
                //table.Columns.Remove("ImportMonth");
                table.Columns.Remove("CreatedDate");
                table.Columns.Remove("TableName");


                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 = "Project Name List " + 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("Project");

                        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[2, 2].Style.Font.Name = "Zawgyi-One";

                        //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());
                        // Response.Output.Write("<meta http-equiv=\"Content-Type\"content=\"text/html; charset=utf-8\">");
                        this.Response.End();
                    }
                } // End Export Block


                #endregion // End Probes
            }
            else
            {
                MessageBox.MessageShow(this.GetType(), "Please Choose Export Date!.", ClientScript);
            }
        }
Exemple #30
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            IList <XmlStudent>        student         = new List <XmlStudent>();
            IList <XmlStudentUpload>  uploads         = new List <XmlStudentUpload>();
            IList <XmlSponosorUpload> sponosorUploads = new List <XmlSponosorUpload>();
            XmlStudentUpload          newUploads;
            XmlSponosorUpload         sponosorUpload;

            DataSet ds = new DataSet();

            ds.ReadXml(lblFileName.Text);

            if (ds.Tables.Count > 0)
            {
                int counter = 0;
                for (int i = 0; i < ds.Tables["Student"].Rows.Count; i++)
                {
                    newUploads = new XmlStudentUpload()
                    {
                        ID            = int.Parse(ds.Tables[0].Rows[i]["ID"].ToString()),
                        RegNum        = ds.Tables[0].Rows[i]["REG_NUMBER"].ToString(),
                        LastName      = ds.Tables[0].Rows[i]["SURNAME"].ToString(),
                        FirstName     = ds.Tables[0].Rows[i]["LASTNAME"].ToString(),
                        OtherName     = ds.Tables[0].Rows[i]["OTHERNAME"].ToString(),
                        FullName      = ds.Tables[0].Rows[i]["FULLNAME"].ToString(),
                        DateofBirth   = ds.Tables[0].Rows[i]["DATE_OF_BIRTH"].ToString(),
                        Gender        = ds.Tables[0].Rows[i]["GENDER"].ToString(),
                        ExamYear      = ds.Tables[0].Rows[i]["EXAM_YEAR"].ToString(),
                        Address       = ds.Tables[0].Rows[i]["ADDRESS"].ToString(),
                        Base64Picture = ds.Tables[0].Rows[i]["PICTURE"].ToString(),
                        SponosorId    = int.Parse(ds.Tables[0].Rows[i]["SPONOSORID"].ToString())
                    };
                    if (newUploads.Gender == "Male")
                    {
                        newUploads.Gender = "M";
                    }
                    else
                    {
                        newUploads.Gender = "F";
                    }
                    uploads.Add(newUploads);
                    for (int j = 0; j < ds.Tables["SPONOSOR_DETAIL"].Rows.Count; j++)
                    {
                        sponosorUpload = new XmlSponosorUpload()
                        {
                            SponosorId           = int.Parse(ds.Tables["SPONOSOR_DETAIL"].Rows[j]["ID"].ToString()),
                            SponosorName         = ds.Tables["SPONOSOR_DETAIL"].Rows[j]["FULLNAME"].ToString(),
                            SponosorEmail        = ds.Tables["SPONOSOR_DETAIL"].Rows[j]["EMAIL"].ToString(),
                            SponosorPhone        = ds.Tables["SPONOSOR_DETAIL"].Rows[j]["PHONE_NUMBER"].ToString(),
                            SponosorAddress      = ds.Tables["SPONOSOR_DETAIL"].Rows[j]["ADDRESS"].ToString(),
                            SponosorRelationship = ds.Tables["SPONOSOR_DETAIL"].Rows[j]["RELATIONSHIP"].ToString(),
                        };
                        sponosorUploads.Add(sponosorUpload);
                        if (sponosorUpload.SponosorId == newUploads.SponosorId)
                        {
                            var result = GeneralUtility.HasQuotaFinished(SessionUser.SchoolId);
                            if (result)
                            {
                                ++counter;
                                GeneralUtility.AddStudent(sponosorUpload, newUploads);
                            }
                        }
                    }
                }
                DropDownManager.ShowPopUp($"{counter} students upload successfully");
                Response.Redirect("~/Modules/School/AllStudents");
            }
        }