Exemple #1
0
 protected void centerSaveButton_Click(object sender, EventArgs e)
 {
     if (centerNameTextBox.Text == "" || districtDropDownList.SelectedIndex == -1 ||
         thanaDropDownList.SelectedIndex == -1)
     {
         msgLabel.Text = "Please enter the value";
     }
     else
     {
         aCenter.CenterName = centerNameTextBox.Text;
         aCenter.CenterCode = GenerateCenterCodeCode();
         // string password = CreateRandomPassword();
         string password = CreateRandomPassword();
         string key      = "pavel";
         byte[] hashKey  = aManager.GetHashKey(key);
         aCenter.CenterPassword = aManager.Encrypt(hashKey, password);
         aCenter.ThanaId        = Convert.ToInt32(thanaDropDownList.SelectedValue);
         string test = aManager.Save(aCenter);
         if (test == "Saved Succesfully")
         {
             string decrptedPassword = aManager.Decrypt(hashKey, aCenter.CenterPassword);
             Session["centerName"] = aCenter.CenterName;
             Session["centerCode"] = aCenter.CenterCode;
             Session["password"]   = decrptedPassword;
             //Response.Redirect("DisplayCenter.aspx?centerName=" + aCenter.CenterName + "&centerCode=" +
             //                  aCenter.CenterCode + "&password="******"DisplayCenterPage.aspx");
         }
         else
         {
             msgLabel.Text = test;
         }
     }
 }
        protected void logincenterButon_OnClick(object sender, EventArgs e)
        {
            string key = "i am Ram";

            byte[] hashkey = centerManager.GetHashKey(key);

            string code     = codeTextBox.Text;
            string password = passwordTextBox.Text;

            Session["centerCode"] = codeTextBox.Text;

            string encryptedpassword = centerManager.Encrypt(hashkey, password);

            bool login = centerManager.LoginMessage(code, encryptedpassword);

            if (login)
            {
                label3.Text      = "Login Successful";
                Session["value"] = codeTextBox.Text;

                Response.Redirect("CenterHomeUI.aspx");
            }

            else
            {
                label3.Text = "Incorrect Code or Password";
            }
        }
 protected void loginButton_Click(object sender, EventArgs e)
 {
     if (centerCodeTextBox.Text == "" || passwordTextBox.Text == "")
     {
         msgLabel.Text = "Please enter values";
     }
     else
     {
         string centerCode        = centerCodeTextBox.Text;
         string password          = passwordTextBox.Text;
         string key               = "pavel";
         byte[] hashKey           = manager.GetHashKey(key);
         string encryptedPassword = manager.Encrypt(hashKey, password);
         if (manager.Login(centerCode, encryptedPassword))
         {
             Center aCenter = manager.GetCenter(centerCode, encryptedPassword);
             Session["centerName"] = aCenter.CenterName;
             Session["centerId"]   = aCenter.CenterId;
             Response.Redirect("CenterHomePage.aspx");
             //Response.Redirect("CenterHome.aspx?centerName="+aCenter.CenterName+"&centerId="+aCenter.CenterId);
         }
         else
         {
             msgLabel.Text = "Center Code or Password is invalid";
         }
     }
 }
Exemple #4
0
        protected void savecentralControlEntryButton_OnClick(object sender, EventArgs e)
        {
            string key = "i am Ram";

            byte[] hashKey = centerManager.GetHashKey(key);

            center.Name = nameTextBox.Text;

            center.DistrictId = int.Parse(districtDropDownList.SelectedValue.ToString());

            center.ThanaId = int.Parse(thanaDropDownList.SelectedValue.ToString());

            string districtname = districtDropDownList.SelectedItem.Text;
            string thananame    = thanaDropDownList.SelectedItem.Text;

            center.Code = GetCode(districtname, thananame);

            string password = GetPassword();

            center.Password = centerManager.Encrypt(hashKey, password);



            if (!centerManager.HasThisCenterExists(center.Name, center.ThanaId))
            {
                centerManager.Insert(center);


                string decryptedpassword = centerManager.Decrypt(hashKey, center.Password);

                Response.Redirect("CenterInfoUI.aspx?districtName=" + districtname + "&thanaName=" + thananame +
                                  "&centerName=" + center.Name + "&centerCode=" + center.Code + "&centerPassword="******"Error";
            }
        }