public  void SetUserInfo(KidsUser User)
        {
            if (User == null)
                return;

            try
            {
                var States = User.StatusHistory.Split(",".ToCharArray(), StringSplitOptions.None);
                List<KidsUserState> AllStates = KidsUser_DataProvider.GetKidsUserStates();

                foreach (string s in States)
                {
                    Image img = new Image
                        {
                            ID = string.Format("imgState{0}", s),
                            ClientIDMode = ClientIDMode.Static,
                            ImageUrl = "~/App_Themes/Default/Images/KidsUserStatus/Green.png",
                            ImageAlign = ImageAlign.Middle,
                            ToolTip = AllStates.First(o => o.Id == s.ToInt32()).StateName,
                            Width = 24,
                            Height = 24
                        };
                    TooltipScript += string.Format(" $('#{0}').powerTip({{ placement: 'n' }});\r\n", img.ID);


                    Label lbl = new Label {Text = "--->"};
                    StatePlaceHolder.Controls.Add(img);
                    StatePlaceHolder.Controls.Add(lbl);
                }

                var LastItem = AllStates.First(o => o.Id == States.Last().ToInt32());
                lblLastStatus.Text = LastItem.StateName;

                if (LastItem.NextId.HasValue)
                {
                    Image imgLast = new Image
                        {
                            ID = string.Format("imgState{0}", LastItem.NextId),
                            ClientIDMode = ClientIDMode.Static,
                            ImageUrl = "~/App_Themes/Default/Images/KidsUserStatus/Gray.png",
                            ToolTip = AllStates.First(o => o.Id == LastItem.NextId).StateName,
                            ImageAlign = ImageAlign.Middle,
                            Width = 24,
                            Height = 24
                        };
                    TooltipScript += string.Format(" $('#{0}').powerTip({{ placement: 'n' }});\r\n", imgLast.ID);
                    StatePlaceHolder.Controls.Add(imgLast);
                }
                else
                {
                    StatePlaceHolder.Controls.RemoveAt(StatePlaceHolder.Controls.Count - 1);
                }
            }
            catch (Exception ex)
            {
                LogUtility.WriteEntryEventLog("KidsUserSateWidget", ex, EventLogEntryType.Error);
            }
        }
        public string AddTempUser(KidsUser user)
        {
            var userlist = Mapptable.Where(o => o.Value.User.KidsUserId == user.KidsUserId).Select(o => o.Key).ToList();
            foreach (var pair in userlist)
                Mapptable.Remove(pair);

            string Key = Guid.NewGuid().ToString();
            Mapptable.Add(Key, new TempUserWrapper { User = user, CreateDateTime = DateTime.Now });
            return Key;
        }
        public void SetUserInfo(KidsUser user)
        {
            if (user != null)
            {
                SessionItems.ChildPic = null;
                SessionItems.ChildIdentityPic = null;
                SessionItems.ChildNationalCardFaceDownPic = null;
                SessionItems.ChildNationalCardFaceUpPic = null;

                lblSSOUserName.Text = user.SSOUserName;
                lblIntroducer.Text = user.IntroducerUser == null ? null : string.Format("{0} {1}", user.IntroducerUser.ChildName, user.IntroducerUser.ChildFamily);
                lblBirthDate.Text = PersianDateTime.MiladiToPersian(user.ChildBirthDate).ToLongDateString();
                lblChildAddress.Text = user.ChildPostAddress;
                lblChildBirthLocation.Text = user.ChildBirthLocation;
                lblChildEmailAddress.Text = user.ChildEmailAddress;
                lblChildFamily.Text = user.ChildFamily;
                lblChildFatherName.Text = user.ChildFatherName;
                lblChildIdentityNo.Text = user.ChildIdentityNo;
                lblChildIdentitySerial.Text = user.ChildIdentitySerial;
                lblChildMelliCode.Text = user.ChildMelliCode;
                lblChildMobileNumber.Text = user.ChildMobileNumber;
                lblChildName.Text = user.ChildName;
                lblChildPhoneNumber.Text = user.ChildPhoneNumber;
                lblChildPostCode.Text = user.ChildPostCode;
                lblSex.Text = user.ChildSex ? "مرد" : "زن";

                lblParentAddress.Text = user.ParentPostAddress;
                lblParentEmailAddress.Text = user.ParentEmailAddress;
                lblParentFamily.Text = user.ParentFamily;
                lblParentIdentityNo.Text = user.ParentIdentityNo;
                lblParentMelliCode.Text = user.ParentMelliCode;
                lblParentMobileNumber.Text = user.ParentMobileNumber;
                lblParentName.Text = user.ParentName;
                lblParentPhoneNumber.Text = user.ParentPhoneNumber;
                lblParentPostCode.Text = user.ParentPostCode;
                lblParentRelationId.Text = user.ParentRelation.ParentRelationName;
                lblParentAccNo.Text = user.ParentAccNo;

                ucKidsUserSateWidget.SetUserInfo(user);
                lblWishAccountnumber.Text = user.ChildAccNo;
                string tx_date;
                lblWishAccountRemain.Text = string.IsNullOrWhiteSpace(user.ChildAccNo) ? "" : BMICustomer_DataProvider.GetAccRemain(user, out tx_date).ToString().Money3Dispaly();
                lblWishAccountBranch.Text = user.ChildAccBranchNo.HasValue ? user.ChildAccBranchNo.ToString() : "";

                SupportedFileSize = FileUploadUtil.GetFileSize(UploadFileSizeLimitation._500K).ToString();
                SupportedFileTypesScript = FileUploadUtil.GetFileTypes(UploadFileType.Pictures);
            }
        }
        private static void SaveScore(int GameId, int ScoreId, long Value, KidsUser user)
        {
            Game g = Game_DataProvider.GetGame(GameId).FirstOrDefault();
            if (g == null)
                throw new ApplicationException("Game not found");

            if (g.ScoreTypes.All(o => o.Id != ScoreId))
                throw new ApplicationException("Score not found or this score is not for this game");

            ScoreType scoreType = g.ScoreTypes.First(o => o.Id == ScoreId);

            if (scoreType.CoefficentValue < 0)
            {
                List<scoreListItem> DailyscoreList, MonthlyscoreList;
                var score = ScoreHelper.CalculateScore(user, true, out DailyscoreList,out MonthlyscoreList);
                if (score + (Value * scoreType.CoefficentValue) < 0)
                    throw new ApplicationException("there is not enoght score for use!Current Score Is :" + score);
            }
            
            ScoreHelper.AddScore(user, scoreType, Value);
        }
        public void SetUserInfo(KidsUser user, bool BasicInfoIsEditable)
        {
            if (user != null)
            {
                SetBasicInfoIsEditable(BasicInfoIsEditable);

                SessionItems.ChildPic = null;
                SessionItems.ChildIdentityPic = null;
                SessionItems.ChildNationalCardFaceDownPic = null;
                SessionItems.ChildNationalCardFaceUpPic = null;

                lblSSOUserName.Text = user.SSOUserName;
                txtIntruducerId.Text = user.IntroducerUser == null ? null : string.Format("{0} {1}", user.IntroducerUser.ChildName, user.IntroducerUser.ChildFamily);

                drpUserState.SelectedValue = user.CurrentStatus.ToString();
                ucBirthDate.SelectedDateTime = user.ChildBirthDate;
                txtChildAddress.Text = user.ChildPostAddress;
                txtChildBirthLocation.Text = user.ChildBirthLocation;
                txtChildEmailAddress.Text = user.ChildEmailAddress;
                txtChildFamily.Text = user.ChildFamily;
                txtChildFatherName.Text = user.ChildFatherName;
                txtChildIdentityNo.Text = user.ChildIdentityNo;

                drpChildIdentitySerial1.SelectedValue = string.IsNullOrWhiteSpace(user.ChildIdentitySerial) ? "" : user.ChildIdentitySerial.Split('-')[0];
                drpChildIdentitySerial2.SelectedValue = string.IsNullOrWhiteSpace(user.ChildIdentitySerial) ? "" : user.ChildIdentitySerial.Split('-')[1];
                txtChildIdentitySerial3.Text = string.IsNullOrWhiteSpace(user.ChildIdentitySerial) ? "" : user.ChildIdentitySerial.Split('-')[2];

                txtChildMelliCode.Text = user.ChildMelliCode;
                txtChildMobileNumber.Text = user.ChildMobileNumber;
                txtChildName.Text = user.ChildName;


                txtChildPhoneNumber1.Text = string.IsNullOrWhiteSpace(user.ChildPhoneNumber) ? "" : user.ChildPhoneNumber.Split('-')[0];
                txtChildPhoneNumber2.Text = string.IsNullOrWhiteSpace(user.ChildPhoneNumber) ? "" : user.ChildPhoneNumber.Split('-')[1];



                txtChildPostCode.Text = user.ChildPostCode;
                drpSex.Text = user.ChildSex ? "True" : "False";


                txtChildAccNo.Text = user.ChildAccNo;
                txtChildAccBranchNo.Text = user.ChildAccBranchNo.HasValue ? user.ChildAccBranchNo.ToString() : "";

                txtParentAddress.Text = user.ParentPostAddress;
                txtParentEmailAddress.Text = user.ParentEmailAddress;
                txtParentFamily.Text = user.ParentFamily;
                txtParentIdentityNo.Text = user.ParentIdentityNo;
                txtParentMelliCode.Text = user.ParentMelliCode;
                txtParentMobileNumber.Text = user.ParentMobileNumber;
                txtParentName.Text = user.ParentName;
                txtParentAccNo.Text = user.ParentAccNo;

                txtParentPhoneNumber1.Text = string.IsNullOrWhiteSpace(user.ParentPhoneNumber) ? "" : user.ParentPhoneNumber.Split('-')[0];
                txtParentPhoneNumber2.Text = string.IsNullOrWhiteSpace(user.ParentPhoneNumber) ? "" : user.ParentPhoneNumber.Split('-')[1];

                txtParentPostCode.Text = user.ParentPostCode;
                drpParentRelationId.SelectedValue = user.ParentRelation.ParentRelationId.ToString();
                ucKidsUserSateWidget.SetUserInfo(user);
                lblWishAccountnumber.Text = user.ChildAccNo;

                try
                {
                string tx_date;
                    //lblWishAccountRemain.Text = string.IsNullOrWhiteSpace(user.ChildAccNo)
                    //                                ? ""
                    //                                : BMICustomer_DataProvider.GetAccRemain(user, out tx_date).ToString().Money3Dispaly() + " ریال ";
                }
                catch{}
                lblWishAccountBranch.Text = user.ChildAccBranchNo.HasValue ? user.ChildAccBranchNo.ToString() : "";


            }
        }
        private static Image GetPicFromDB(ImageActType Act, KidsUser u, string BasdeFolder, bool ReplaceEmptyPicture, int? width, int? hight)
        {
            var c = HttpContext.Current.Server;
            Image img = null;

            switch (Act)
            {
                case ImageActType.ChildImage_Main:
                    try
                    {
                        if (ReplaceEmptyPicture)
                            img = !string.IsNullOrWhiteSpace(u.ChildPic)
                                      ? Image.FromFile(BasdeFolder + u.ChildPic)
                                      : Image.FromFile(u.ChildSex
                                                       ? c.MapPath("~/App_Themes/Default/images/1.jpg")
                                                       : c.MapPath("~/App_Themes/Default/images/0.jpg")
                                                       );
                        else
                            img = !string.IsNullOrWhiteSpace(u.ChildPic)
                                 ? Image.FromFile(BasdeFolder + u.ChildPic)
                                 : new Bitmap(0, 0);
                    }
                    catch
                    {
                        img = Image.FromFile(c.MapPath("~/App_Themes/Default/images/unknown_user.jpg"));
                    }
                    break;

                case ImageActType.ChildPic:
                    try
                    {
                        if (ReplaceEmptyPicture)
                            img = !string.IsNullOrWhiteSpace(u.ChildPic)
                                      ? Image.FromFile(BasdeFolder + u.ChildPic)
                                      : Image.FromFile(c.MapPath("~/App_Themes/Default/images/Blank.jpg"));
                        else
                            img = !string.IsNullOrWhiteSpace(u.ChildPic)
                                 ? Image.FromFile(BasdeFolder + u.ChildPic)
                                 : new Bitmap(0, 0);
                    }
                    catch
                    {
                        img = Image.FromFile(c.MapPath("~/App_Themes/Default/images/unknown_user.jpg"));
                    }
                    break;

                case ImageActType.ChildIdentityPic:
                    try
                    {
                        if (ReplaceEmptyPicture)
                            img = !string.IsNullOrWhiteSpace(u.ChildIdentityPic)
                                     ? Image.FromFile(BasdeFolder + u.ChildIdentityPic)
                                     : Image.FromFile(c.MapPath("~/App_Themes/Default/images/Blank.jpg"));
                        else
                            img = !string.IsNullOrWhiteSpace(u.ChildIdentityPic)
                                 ? Image.FromFile(BasdeFolder + u.ChildIdentityPic)
                                 : new Bitmap(0, 0);
                    }
                    catch
                    {
                        img = Image.FromFile(c.MapPath("~/App_Themes/Default/images/unknown_user.jpg"));
                    }
                    break;

                case ImageActType.ChildNationalCardFaceUPPic:
                    try
                    {
                        if (ReplaceEmptyPicture)
                            img = !string.IsNullOrWhiteSpace(u.ChildNationalCardFaceUPPic)
                                     ? Image.FromFile(BasdeFolder + u.ChildNationalCardFaceUPPic)
                                     : Image.FromFile(c.MapPath("~/App_Themes/Default/images/Blank.jpg"));
                        else
                            img = !string.IsNullOrWhiteSpace(u.ChildNationalCardFaceUPPic)
                                 ? Image.FromFile(BasdeFolder + u.ChildNationalCardFaceUPPic)
                                 : new Bitmap(0, 0);
                    }
                    catch
                    {
                        img = Image.FromFile(c.MapPath("~/App_Themes/Default/images/unknown_user.jpg"));
                    }
                    break;

                case ImageActType.ChildNationalCardFaceDownPic:
                    try
                    {
                        if (ReplaceEmptyPicture)
                            img = !string.IsNullOrWhiteSpace(u.ChildNationalCardFaceDownPic)
                                     ? Image.FromFile(BasdeFolder + u.ChildNationalCardFaceDownPic)
                                     : Image.FromFile(c.MapPath("~/App_Themes/Default/images/Blank.jpg"));
                        else
                            img = !string.IsNullOrWhiteSpace(u.ChildNationalCardFaceDownPic)
                                 ? Image.FromFile(BasdeFolder + u.ChildNationalCardFaceDownPic)
                                 : new Bitmap(0, 0);
                    }
                    catch
                    {
                        img = Image.FromFile(c.MapPath("~/App_Themes/Default/images/unknown_user.jpg"));
                    }
                    break;
            }

            if (width.HasValue && hight.HasValue)
                img = FileUploadUtil.ResizeImage(img, new Size(width.Value, hight.Value));
            return img;
        }
        internal KidsUser GetUserInfo(KidsUser user)
        {
            if (drpUserState.SelectedValue != "-1")
                user.CurrentStatus = drpUserState.SelectedValue.ToInt32();
            user.ChildBirthDate = ucBirthDate.SelectedDateTime.Value;
            user.ChildPostAddress = txtChildAddress.Text;
            user.ChildBirthLocation = txtChildBirthLocation.Text;
            user.ChildEmailAddress = txtChildEmailAddress.Text;
            user.ChildFamily = txtChildFamily.Text;
            user.ChildFatherName = txtChildFatherName.Text;
            user.ChildIdentityNo = txtChildIdentityNo.Text;

            user.ChildIdentitySerial = (drpChildIdentitySerial1.SelectedValue.IsInt32() && drpChildIdentitySerial2.SelectedValue.IsInt32() && !string.IsNullOrWhiteSpace(txtChildIdentitySerial3.Text))
                                       ? null :
                                       string.Format("{0}-{1}-{2}", drpChildIdentitySerial1.SelectedValue, drpChildIdentitySerial2.SelectedValue, txtChildIdentitySerial3.Text);


            user.ChildMelliCode = txtChildMelliCode.Text;
            user.ChildMobileNumber = txtChildMobileNumber.Text;
            user.ChildName = txtChildName.Text;


            user.ChildPhoneNumber = txtChildPhoneNumber1.Text + "-" + txtChildPhoneNumber2.Text;


            user.ChildPostCode = txtChildPostCode.Text;
            user.ChildSex = drpSex.SelectedValue.ToBool();

            user.ChildAccNo = txtChildAccNo.Text;
            user.ChildAccBranchNo = string.IsNullOrWhiteSpace(txtChildAccBranchNo.Text) ? (int?)null : txtChildAccBranchNo.Text.ToInt32();

            user.ParentPostAddress = txtParentAddress.Text;
            user.ParentEmailAddress = txtParentEmailAddress.Text;
            user.ParentFamily = txtParentFamily.Text;
            user.ParentIdentityNo = txtParentIdentityNo.Text;
            user.ParentMelliCode = txtParentMelliCode.Text;
            user.ParentMobileNumber = txtParentMobileNumber.Text;
            user.ParentName = txtParentName.Text;
            user.ParentAccNo = txtParentAccNo.Text;

            user.ParentPhoneNumber = txtParentPhoneNumber1.Text + "-" + txtParentPhoneNumber2.Text;

            user.ParentPostCode = txtParentPostCode.Text;
            user.ParentRelation.ParentRelationId = drpParentRelationId.SelectedValue.ToInt32();

            return user;
        }
 public void SetUserInfo(KidsUser user)
 {
     dgPaymentList.DataSource = user.KidsUsers_Payments;
     dgPaymentList.DataBind();
 }
        public static Image GetPicFromDB(KidsUser u, ImageActType Act, bool ReplaceEmptyPicture, int? width, int? hight)
        {
            var c = HttpContext.Current.Server;

            string BasdeFolder = c.MapPath(SystemConfigs.UrlKidsPicFilesPath(u.SSOUserName));
            Image img = GetPicFromDB(Act, u, BasdeFolder, ReplaceEmptyPicture, width, hight);

            return img;
        }
Beispiel #10
0
        protected void txtRegisterUserInfo_Click(object sender, EventArgs e)
        {
            if (SessionItems.CaptchaImageTextForRegister.ToLower() != txtCaptchaImage.Text.ToLower())
            {
                ShowMessageBox("متن تصویر وارد شده صحیح نمیباشد", "خطا");
                txtCaptchaImage.Text = "";
                return;
            }

            if (!txtChildMelliCode.Text.IsValidMelliCode())
            {
                ShowMessageBox("کد ملی کودک نا معتبر است", "خطا");
                return;
            }

            if (!txtParentMelliCode.Text.IsValidMelliCode())
            {
                ShowMessageBox("کد ملی ولی نا معتبر است", "خطا");
                return;
            }

            if (!ucBirthDate.SelectedDateTime.HasValue)
            {
                ShowMessageBox("تاریخ تولد نا معتبر است", "خطا");
                return;
            }

            if (ucBirthDate.SelectedDateTime.CalculateAge() >= 18)
            {
                ShowMessageBox("کاربرگرامی سن شما بیش از 18 سال میباشدو شما نمیتوانید از مزایای حساب آرزو بهره مند شوید", "خطا");
                return;
            }



            if (!IsValidBMICustomer(txtChildMelliCode.Text,
                                    txtChildIdentityNo.Text,
                                    txtChildFatherName.Text,
                                    txtChildName.Text,
                                    txtChildFamily.Text, ucBirthDate.SelectedPersianDateTime, true)
                )
            {
                return;
            }


            if (!IsValidBMICustomer(txtParentMelliCode.Text,
                                   txtParentIdentityNo.Text,
                                   null,
                                   txtParentName.Text,
                                   txtParentFamily.Text, null, false)
               )
            {
                return;
            }

            KidsUser intruducerUser = null;
            var IntruducerId = string.IsNullOrWhiteSpace(txtIntruducerId.Text) ? (long?)null : txtIntruducerId.Text.ToLong();
            if (IntruducerId.HasValue)
                intruducerUser = KidsUser_DataProvider.GetKidsUser(KidsUserId: IntruducerId).FirstOrDefault();

            var newuser = new KidsUser
                {
                    SSOUserName = OnlineKidsUser.SSOUser.UserID,
                    IntruducerId = intruducerUser == null ? (long?)null : intruducerUser.KidsUserId,

                    ChildSex = drpSex.SelectedValue.ToBool(),
                    ChildBirthDate = ucBirthDate.SelectedDateTime.Value,
                    ChildBirthLocation = txtChildBirthLocation.Text,
                    ChildFatherName = txtChildFatherName.Text,
                    ChildEmailAddress = txtChildEmailAddress.Text,
                    ChildFamily = txtChildFamily.Text,
                    ChildMelliCode = txtChildMelliCode.Text,
                    ChildMobileNumber = txtChildMobileNumber.Text,
                    ChildName = txtChildName.Text,
                    ChildPhoneNumber = txtChildPhoneNumber1.Text + "-" + txtChildPhoneNumber2.Text,
                    ChildPostCode = txtChildPostCode.Text,
                    ChildPostAddress = txtChildAddress.Text,
                    ChildIdentityNo = txtChildIdentityNo.Text,

                    ChildIdentitySerial = (drpChildIdentitySerial1.SelectedValue.IsInt32() && drpChildIdentitySerial2.SelectedValue.IsInt32() && !string.IsNullOrWhiteSpace(txtChildIdentitySerial3.Text)) 
                                          ? null : 
                                          string.Format("{0}-{1}-{2}", drpChildIdentitySerial1.SelectedValue, drpChildIdentitySerial2.SelectedValue, txtChildIdentitySerial3.Text),


                    ParentEmailAddress = txtParentEmailAddress.Text,
                    ParentFamily = txtParentFamily.Text,
                    ParentMelliCode = txtParentMelliCode.Text,
                    ParentMobileNumber = txtParentMobileNumber.Text,
                    ParentName = txtParentName.Text,
                    ParentPhoneNumber = txtParentPhoneNumber1.Text + "-" + txtParentPhoneNumber2.Text,
                    ParentPostCode = txtParentPostCode.Text,
                    ParentPostAddress = txtParentAddress.Text,
                    ParentRelationId = drpParentRelationId.SelectedValue.ToInt32(),

                    ChildAccNo = null,
                    ParentAccNo = null,
                    StatusHistory = ((int)KidsUserStatus.RegisterWithoutConfirmation).ToString(),
                    CurrentStatus = (int)KidsUserStatus.RegisterWithoutConfirmation,


                    ChildPic = SessionItems.ChildPic,
                    ChildIdentityPic = SessionItems.ChildIdentityPic,
                    ChildNationalCardFaceUPPic = SessionItems.ChildNationalCardFaceUpPic,
                    ChildNationalCardFaceDownPic = SessionItems.ChildNationalCardFaceDownPic

                };

            try
            {
                KidsUser_DataProvider.SaveKidsUser(newuser, this, RefreshOnlineKidsUserInfo);

                if (intruducerUser != null)
                {
                    var scoreType = Score_DataProvider.GetScoresTypes(ScoreEnName: "INTRODUCER").First();
                    ScoreHelper.AddScore(intruducerUser, scoreType, 1);
                }

                ucUserProfile.SetUserInfo(OnlineKidsUser.Kids_UserInfo);
                pnlResult1.Visible = true;
                pnlAccCreation.Visible = false;

            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("IX_KidsUsers_UniqueMelliCode"))
                    ShowMessageBox("خطا در ثبت اطلاعات :<BR> کد ملی در سیستم استفاده شده است", "خطا");
                else
                    ShowMessageBox(ex.Message + "خطا در ثبت اطلاعات", "خطا");
            }

        }
 private Guid GetTemproryLink(KidsUser user)
 {
     return TempLinkManager.Instanse.AddLink(MapPath(string.Format("/AdminCP/Files/KidsPic/{0}/{1}", user.SSOUserName, user.ChildPic)));
 }
        private void FillExcellRow(KidsUser user, ExcelWorksheet sheet)
        {
            string ChildFullName = user.ChildName + " " + user.ChildFamily;
            var ArrChildFullName = ChildFullName.ToCharArray();

            sheet.Cells["G5"].Value = user.ChildAccBranchNo.HasValue ? user.ChildAccBranchNo.ToString() : "";
            sheet.Cells["G6"].Value = PersianDateTime.Now.ToString("/");
            sheet.Cells["N8"].Value = "سپرده کوتاه مدت - آرزو";
            sheet.Cells["G10"].Value = ChildFullName;
            sheet.Cells["J12"].Value = user.ChildFamily;
            sheet.Cells["J14"].Value = user.ChildName;
            sheet.Cells["I17"].Value = user.ChildCustomerNo;
            sheet.Cells["I18"].Value = user.ChildAccNo;
            sheet.Cells["I19"].Value = "";

            for (int i = 0; i < ArrChildFullName.Length; i++)
                sheet.Cells[22, i + 5].Value = ArrChildFullName[i].ToString();

            sheet.Cells["H25"].Value = user.ChildFatherName;
            sheet.Cells["T25"].Value = user.ChildIdentityNo;

            var perbdate = PersianDateTime.MiladiToPersian(user.ChildBirthDate);
            sheet.Cells["AF25"].Value = perbdate.Day;
            sheet.Cells["AG25"].Value = perbdate.Month;
            sheet.Cells["AH25"].Value = perbdate.Year;

            sheet.Cells["H27"].Value = user.ChildBirthLocation;
            sheet.Cells["T27"].Value = "";
            sheet.Cells["AF27"].Value = "";

            sheet.Cells["H29"].Value = "";
            sheet.Cells["J29"].Value = "";
            sheet.Cells["L29"].Value = "";
            sheet.Cells["T29"].Value = "ایرانی";
            sheet.Cells["AF29"].Value = user.ChildMelliCode;


            string sex = user.ChildSex ? "K32" : "K31";
            sheet.Cells[sex].Style.Fill.PatternType = ExcelFillStyle.Solid;
            sheet.Cells[sex].Style.Fill.BackgroundColor.SetColor(Color.Black);

            sheet.Cells["W31"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            sheet.Cells["W31"].Style.Fill.BackgroundColor.SetColor(Color.Black);

            sheet.Cells["AH32"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            sheet.Cells["AH32"].Style.Fill.BackgroundColor.SetColor(Color.Black);



            sheet.Cells["H34"].Value = "";
            sheet.Cells["T34"].Value = "";
            sheet.Cells["AF34"].Value = user.ChildPostCode;

            sheet.Cells["H36"].Value = "";
            sheet.Cells["T36"].Value = user.ChildPhoneNumber;
            sheet.Cells["AF36"].Value = "";

            sheet.Cells["H38"].Value = user.ChildMobileNumber;
            sheet.Cells["T38"].Value = "";
            sheet.Cells["AF38"].Value = user.ChildIdentitySerial;


            sheet.Cells["M40"].Value = user.ChildEmailAddress;

            sheet.Cells["I41"].Value = "";
            sheet.Cells["H42"].Value = user.ChildPostAddress;

        }
 public static long GetAccRemain(KidsUser user, out string LastTransactionDate)
 {
     var AccBill = GetAccBill(user.ChildAccNo, PersianDateTime.Now.AddDays(-40).ToString(), PersianDateTime.Now.ToString()).LastOrDefault();
     if (AccBill != null)
     {
         LastTransactionDate = AccBill.tx_date;
         return AccBill.tx_cbalance.ToLong();
     }
     LastTransactionDate = "";
     return 0;
 }
        public static void SaveKidsUser(KidsUser user, object p, Action<Object> a)
        {
            using (var ctx = new BMIKidsEntities(ConnectionString))
            {
                try
                {
                    if (user.ChangeTracker.State == ObjectState.Unchanged)
                        user.MarkAsModified();

                    if (user.ChangeTracker.State == ObjectState.Added)
                    {
                        user.CreateDateTime = DateTime.Now;
                        user.LastUpdateDateTime = null;
                    }
                    else
                        user.LastUpdateDateTime = DateTime.Now;

                    ctx.KidsUsers.ApplyChanges(user);
                    ctx.SaveChanges();
                    user.AcceptChanges();

                    if (a != null)
                        a(p);
                }
                catch (Exception ex)
                {
                    LogUtility.WriteEntryEventLog("SaveSystemUser_DataProvider_UpdateTransaction", ex, EventLogEntryType.Information);
                    if (ex.InnerException != null)
                        throw ex.InnerException;
                    throw;
                }
            }
        }
Beispiel #15
0
     private void FixupIntroducerUser(KidsUser previousValue, bool skipKeys = false)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (IntroducerUser != null)
         {
             IntruducerId = IntroducerUser.KidsUserId;
         }
 
         else if (!skipKeys)
         {
             IntruducerId = null;
         }
 
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("IntroducerUser")
                 && (ChangeTracker.OriginalValues["IntroducerUser"] == IntroducerUser))
             {
                 ChangeTracker.OriginalValues.Remove("IntroducerUser");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("IntroducerUser", previousValue);
             }
             if (IntroducerUser != null && !IntroducerUser.ChangeTracker.ChangeTrackingEnabled)
             {
                 IntroducerUser.StartTracking();
             }
         }
     }
 private Guid GetTemproryLink(KidsUser user)
 {
     return TempLinkManager.Instanse.AddLink(MapPath(string.Format("/AdminCP/Files/BirthDay/{0}.swf", user.ChildAge.ToInt32())));
 }
        protected void btnNewKidsUser_Click(object sender, EventArgs e)
        {
            ClearControl(pnlDetails);

            PageState = Action.Add;
            CurrentKidsUser = new KidsUser();

            pnlResult.Visible = false;
            pnlDetails.Visible = true;

        }
        private void FillExcellRow(KidsUser user, ExcelWorksheet sheet, int RowId)
        {
            sheet.Cells[RowId, 1].Value = user.KidsUserId;
            sheet.Cells[RowId, 2].Value = user.IntruducerId;
            sheet.Cells[RowId, 3].Value = user.SSOUserName;
            sheet.Cells[RowId, 4].Value = user.ChildName;
            sheet.Cells[RowId, 5].Value = user.ChildFamily;
            sheet.Cells[RowId, 6].Value = user.ChildFatherName;
            sheet.Cells[RowId, 7].Value = user.ChildSex;
            sheet.Cells[RowId, 8].Value = user.ChildMelliCode;
            sheet.Cells[RowId, 9].Value = user.ChildIdentityNo;
            sheet.Cells[RowId, 10].Value = user.ChildIdentitySerial;
            sheet.Cells[RowId, 11].Value = user.ChildBirthLocation;
            sheet.Cells[RowId, 12].Value = user.ChildBirthDate;
            sheet.Cells[RowId, 13].Value = user.ChildAge;
            sheet.Cells[RowId, 14].Value = user.ChildPersianBirthDay;
            sheet.Cells[RowId, 15].Value = user.ChildMobileNumber;
            sheet.Cells[RowId, 16].Value = user.ChildPhoneNumber;
            sheet.Cells[RowId, 17].Value = user.ChildEmailAddress;

            sheet.Cells[RowId, 18].Value = user.ChildPostCode;
            sheet.Cells[RowId, 19].Value = user.ChildPostAddress;
            sheet.Cells[RowId, 20].Value = user.ParentRelationId;
            sheet.Cells[RowId, 21].Value = user.ParentName;
            sheet.Cells[RowId, 22].Value = user.ParentFamily;
            sheet.Cells[RowId, 23].Value = user.ParentIdentityNo;
            sheet.Cells[RowId, 24].Value = user.ParentMelliCode;
            sheet.Cells[RowId, 25].Value = user.ParentMobileNumber;
            sheet.Cells[RowId, 26].Value = user.ParentPhoneNumber;
            sheet.Cells[RowId, 27].Value = user.ParentEmailAddress;
            sheet.Cells[RowId, 28].Value = user.ParentPostCode;
            sheet.Cells[RowId, 29].Value = user.ParentPostAddress;
            sheet.Cells[RowId, 30].Value = user.ChildAccNo;
            sheet.Cells[RowId, 31].Value = user.ChildAccBranchNo;
            sheet.Cells[RowId, 32].Value = user.ChildCustomerNo;
            sheet.Cells[RowId, 33].Value = user.ParentAccNo;
            sheet.Cells[RowId, 34].Value = user.ParentCustomerNo;
            sheet.Cells[RowId, 35].Value = user.LastCalculatedScore;
            sheet.Cells[RowId, 36].Value = user.CurrentStatus;
            sheet.Cells[RowId, 37].Value = user.StatusHistory;
            sheet.Cells[RowId, 38].Value = PersianDateTime.MiladiToPersian(user.CreateDateTime).ToShortDateTimeString();
            sheet.Cells[RowId, 39].Value = user.LastUpdateDateTime.HasValue ? PersianDateTime.MiladiToPersian(user.LastUpdateDateTime.Value).ToShortDateTimeString() : "";

        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            CurrentKidsUser = ucEditableUserProfile.GetUserInfo(CurrentKidsUser);

            if (PageState == Action.Add)
                CurrentKidsUser.MarkAsAdded();
            else if (PageState == Action.Update)
                CurrentKidsUser.MarkAsModified();

            KidsUser_DataProvider.SaveKidsUser(CurrentKidsUser, this, KidsSecureFormBaseClass.RefreshOnlineKidsUserInfo);
            pnlDetails.Visible = false;

            BindGrid();
        }
        protected void dgKidsUser_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            PageState = Action.Update;
            CurrentKidsUser = KidsUser_DataProvider.GetKidsUser(KidsUserId: Convert.ToInt64(dgKidsUser.DataKeys[e.NewSelectedIndex].Value)).FirstOrDefault();
            ClearControl(pnlDetails);

            if (OnlineSystemUser.IsKidsUserManager &&
                !(OnlineSystemUser.IsKidsUserAdmin || OnlineSystemUser.IsSiteAdministrator))
            {
                ucUserProfile.SetUserInfo(CurrentKidsUser);
                ucUserProfile.Visible = true;
                btnSave.Visible = false;
            }
            else
            {
                ucEditableUserProfile.SetUserInfo(CurrentKidsUser, true);
                ucEditableUserProfile.Visible = true;
                btnSave.Visible = true;
            }
            ucPaymentList.SetUserInfo(CurrentKidsUser);

            List<scoreListItem> DailyscoreList, MonthlyscoreList;
            ScoreHelper.CalculateScore(CurrentKidsUser, false, out DailyscoreList, out MonthlyscoreList);
            ucScoreList.SetUserInfo(DailyscoreList, MonthlyscoreList);

            pnlDetails.Visible = true;
        }
Beispiel #21
0
     private void FixupKidsUser(KidsUser previousValue)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.Kids_Wishes.Contains(this))
         {
             previousValue.Kids_Wishes.Remove(this);
         }
 
         if (KidsUser != null)
         {
             if (!KidsUser.Kids_Wishes.Contains(this))
             {
                 KidsUser.Kids_Wishes.Add(this);
             }
 
             KidsUserId = KidsUser.KidsUserId;
         }
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("KidsUser")
                 && (ChangeTracker.OriginalValues["KidsUser"] == KidsUser))
             {
                 ChangeTracker.OriginalValues.Remove("KidsUser");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("KidsUser", previousValue);
             }
             if (KidsUser != null && !KidsUser.ChangeTracker.ChangeTrackingEnabled)
             {
                 KidsUser.StartTracking();
             }
         }
     }
        private void FillExcellRow2(KidsUser user, ExcelWorksheet sheet)
        {
            sheet.Cells["F5"].Value = user.ParentName + " " + user.ParentFamily;
            var acc = BMICustomer_DataProvider.GetAccByMellicode(user.ParentMelliCode).FirstOrDefault();
            if (acc != null) sheet.Cells["I5"].Value = acc.cu_id;

            sheet.Cells["P5"].Value = user.ChildAccBranchNo.HasValue ? user.ChildAccBranchNo.ToString() : "";
            sheet.Cells["P4"].Value = PersianDateTime.Now.ToString("/");
        }