コード例 #1
0
 public UpdateAdmin GetAdminDetailById(int adminId)
 {
     try
     {
         UpdateAdmin updateAdmin    = new UpdateAdmin();
         var         getAdminDetail = (from o in dc.Admins where o.AdminId == adminId select o).FirstOrDefault();
         if (getAdminDetail != null)
         {
             UpdateAdminDetail upAdminDetail = new UpdateAdminDetail();
             upAdminDetail.Name  = getAdminDetail.Name;
             upAdminDetail.Email = getAdminDetail.Email;
             upAdminDetail.Phone = getAdminDetail.Phone;
             string dob  = Convert.ToString(getAdminDetail.DOB);
             string dd   = dob.Substring(0, 2);
             string mm   = dob.Substring(3, 2);
             string yyyy = dob.Substring(6, 4);
             upAdminDetail.DOB             = Convert.ToDateTime(dd + "-" + mm + "-" + yyyy);
             upAdminDetail.Gender          = getAdminDetail.Gender;
             upAdminDetail.IsEditAllow     = true;
             updateAdmin.updateAdminDetail = upAdminDetail;
         }
         else
         {
             updateAdmin.updateAdminDetail = null;
         }
         return(updateAdmin);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #2
0
    //front variables
    // RadioButton complete = document.getElementById('complete').value;
    // RadioButton showall = document.getElementById('showall').value;
    // RadioButton pending = document.getElementById('pending').value;

    // ---------------------------------------------------------------- initial startup

    protected void PageLoad(object sender, EventArgs e)
    {
        update = new UpdateAdmin();
        //DB variables
        string contact_name     = dbDataSet.Tables[0].Rows[0]["sponsorContact"].ToString();
        string business_name    = dbDataSet.Tables[0].Rows[0]["SponsorName"].ToString();
        string business_email   = dbDataSet.Tables[0].Rows[0]["sponsorEmail"].ToString();
        string business_address = dbDataSet.Tables[0].Rows[0]["sponsorAddress"].ToString();
        string phone            = dbDataSet.Tables[0].Rows[0]["sponsorPhone"].ToString();
        string image            = dbDataSet.Tables[0].Rows[0]["image"].ToString();

        // event listeners
        btnSend.ServerClick   += new ImageClickEventHandler(btnSendClick);
        btnSearch.ServerClick += new EventHandler(search);

        // maintain page position after hitting edit and apply buttons
        Page.MaintainScrollPositionOnPostBack = true;

        // build regex objects for input validation
        regexMsg = new Regex("^[\\w\\W\\'][\\w\\W\\s\\'\\-]+$");
        populateDropDown();
    }
コード例 #3
0
        public ActionResult UpdateProfile(UpdateAdmin updateAdmin, HttpPostedFileBase postedFile)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    int  adminId            = Convert.ToInt32(Session[SessionObjects.CNAdminId]);
                    bool updateAdminProfile = adminArearBs.adminBs.UpdateAdminProfile(adminId, updateAdmin.updateAdminDetail, postedFile);
                    if (updateAdminProfile == true)
                    {
                        var getAdminProfileImage = adminArearBs.adminBs.GetProfileImage(adminId);
                        if (getAdminProfileImage.Image != null)
                        {
                            Session["CNAdminImage"] = null;
                            CommanDetails commanDetails = new CommanDetails();
                            commanDetails.Image     = getAdminProfileImage.Image;
                            commanDetails.ImageName = getAdminProfileImage.ImageName;
                            commanDetails.ImageType = getAdminProfileImage.ImageType;
                            commanDetails.Email     = getAdminProfileImage.Email;
                            commanDetails.Name      = getAdminProfileImage.Name;
                            Session["CNAdminImage"] = commanDetails;
                        }
                        Session[SessionObjects.CNAdminEmail] = null;
                        Session[SessionObjects.CNAdminName]  = null;
                        Session[SessionObjects.CNAdminEmail] = getAdminProfileImage.Email;
                        Session[SessionObjects.CNAdminName]  = getAdminProfileImage.Name;
                    }
                    TempData["Msg"] = "Admin detail update successfully";
                }
                return(RedirectToAction("UpdateProfile", "Profile", new { area = "AdminSection" }));
            }
            catch (Exception ex)
            {
                TempData["Fail"] = "Something went wrong ." + ex;
                return(RedirectToAction("UpdateProfile", "Profile", new { area = "AdminSection" }));

                throw;
            }
        }