예제 #1
0
    protected void ibtnSave_Click(object sender, ImageClickEventArgs e)
    {
        string userID = ViewState["UserID"].ToString();

        DataSet dsUserData = employee.CheckUserNameDuplicate(txtUserName.Text, txtMSADUserName.Text, userID);

        if (dsUserData != null && dsUserData.Tables[0].Rows.Count == 0)
        {
            string ColumnValue = " Location='" + lblLocation.Text.Split('-')[1].ToString().Trim() + "'," +
                                 "IMLoc='" + hidLocation.Value.Substring(0, 2) + "'," +
                                 "UserInterfaceInd='" + ddlUserInterface.SelectedItem.Value.ToString() + "'," +
                                 "MSADUserName='******'", "").Replace("\"", "") + "'," +
                                 "DateofLastLogin='******'," +
                                 "NoofLogins=" + ((lblNoLogins.Text != "") ? lblNoLogins.Text : "NULL") + "," +
                                 "LogonStatusInd='" + lblLogStatus.Text + "'," +
                                 "UserName='******'", "").Replace("\"", "") + "'," +
                                 "UserPassword='******'", "").Replace("\"", "") + "'," +
                                 "Domain='" + txtDomain.Text.Replace("'", "").Replace("\"", "") + "'," +
                                 "BuyerInd='" + ddlBuyer.SelectedItem.Value.ToString() + "'," +
                                 "ApproveOrderInd='" + ddlApproveOrders.SelectedItem.Value.ToString() + "'," +
                                 "ARClerkInd='" + ddlARClerk.SelectedItem.Value.ToString() + "'," +
                                 "PrimaryBinPrmpt='" + ddlPrompt.SelectedItem.Value.ToString() + "'," +
                                 "PODolLimit=" + ((txtDollarLimit.Text != "") ? txtDollarLimit.Text : "NULL") + "," +
                                 "ConsumablesAmt=" + ((txtConsumable.Text != "") ? txtConsumable.Text : "NULL") + "," +
                                 "ChangeID='" + Session["UserName"].ToString() + "'," +
                                 "ChangeDt='" + DateTime.Now.ToShortDateString() + "'";

            employee.UpdateUserData(ColumnValue, userID);
            status            = "Success";
            ViewState["Mode"] = "Save";
        }
        else
        {
            Label lbl = Page.FindControl("lblMessage") as Label;

            employee.DisplayMessage(MessageType.Failure, "Username or MSAD Username already exists", lbl);
            UpdatePanel pnl = Page.FindControl("upnlMessage") as UpdatePanel;
            pnl.Update();
        }

        upnlUser.Update();
        upnlMSAD.Update();
        upnlBuyer.Update();
    }