protected void BtncallUpd_Click(object sender, EventArgs e) { try { if (BtncallUpd.Text == "UPDATE") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ShowModel1", "ShowModel1()", true); } else { USER_MASLogicLayer insert = new USER_MASLogicLayer(); // insert.USERCODE = TxtUserCode.Text.Trim().ToUpper(); insert.USERCODE = HfUSER_CODE.Value.Trim(); insert.USERNAME = TxtUserName.Text.Trim(); insert.USERPASS = encrypt(TxtUserPassword.Text.Trim()); insert.USERTYPE = DdlUserType.SelectedValue.Trim().ToUpper(); insert.ACTIVE = DdlUserActive.SelectedValue.Trim().ToUpper(); insert.DEACTIVE_DATE = string.Empty; if (BtncallUpd.Text.Trim().ToUpper() == "SAVE") { string str = USER_MASLogicLayer.InsertUSER_MASDetail(insert); if (str.Contains("successfully")) { lblmsg.Text = "User Detail Add Successfully."; lblmsg.ForeColor = Color.Green; clear(); FillGrid(); UserRights(); } else if (str.Contains("Already") || str.Contains("PRIMARY KEY")) { lblmsg.Text = "User Code already Exist."; lblmsg.ForeColor = Color.Red; } else { lblmsg.Text = "Error : User Detail Not Save"; lblmsg.ForeColor = Color.Red; } } } } catch (Exception) { throw; } }
protected void btnSave_click(object sender, EventArgs e) { try { USER_MASLogicLayer insert = new USER_MASLogicLayer(); // insert.USERCODE = TxtUserCode.Text.Trim().ToUpper(); insert.USERCODE = HfUSER_CODE.Value.Trim(); insert.USERNAME = TxtUserName.Text.Trim(); insert.USERPASS = encrypt(TxtUserPassword.Text.Trim()); insert.USERTYPE = DdlUserType.SelectedValue.Trim().ToUpper(); insert.ACTIVE = DdlUserActive.SelectedValue.Trim().ToUpper(); insert.DEACTIVE_DATE = string.Empty; if (btnSave.Text.Trim().ToUpper() == "SAVE") { string str = USER_MASLogicLayer.InsertUSER_MASDetail(insert); if (str.Contains("successfully")) { lblmsg.Text = "User Detail Add Successfully."; lblmsg.ForeColor = Color.Green; clear(); FillGrid(); UserRights(); } else if (str.Contains("Already") || str.Contains("PRIMARY KEY")) { lblmsg.Text = "User Code already Exist."; lblmsg.ForeColor = Color.Red; } else { lblmsg.Text = "Error : User Detail Not Save"; lblmsg.ForeColor = Color.Red; } } else { string str = USER_MASLogicLayer.UpdateUSER_MASDetail(insert); if (str.Contains("successfully")) { lblmsg.Text = "User Detail Update Successfully."; lblmsg.ForeColor = Color.Green; clear(); FillGrid(); UserRights(); } else if (str.Contains("Already")) { lblmsg.Text = "User Code already Exist."; lblmsg.ForeColor = Color.Red; } else { lblmsg.Text = "Error : User Detail Not Update"; lblmsg.ForeColor = Color.Red; } } } catch (Exception) { throw; } }