protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         try
         {
             //Validate User for Role i.e. it can access page or not
             if (objCommonClass.CheckRolesForMenu(getCurrentURL(), Membership.GetUser().UserName.ToString()) == 0)
             {
                 //   Response.Redirect("../login.aspx");
             }
             //End
             //Populate left menu items using function PopulateMainLeftMenu of CommonClass that is using database table left_menu_master
             objCommonClass.PopulateMainMenu(TopMenu, Membership.GetUser().UserName.ToString());
             strUserTypeCode = objCommonClass.GetUserType(Membership.GetUser().UserName.ToString());
             if ((strUserTypeCode.ToLower() == "cg") || (strUserTypeCode.ToLower() == "cce"))
             {
                 lnkChangePassword.Visible = false;
             }
             objUserMaster.BindUseronUserName(Membership.GetUser().UserName.ToString(), "SELECT_USER_BY_USRNAME");
             dvUser.InnerHtml = "Welcome <b>" + objUserMaster.Name.ToString() + "</b><br/>" + DateTime.Today.ToLongDateString() + "<br/><b>Role:</b> " + objCommonClass.GetRolesForUser(Membership.GetUser().UserName.ToString());
         }
         catch (Exception ex)
         {
             //Writing Error message to File using CommonClass WriteErrorErrFile method taking arguments as URL of page
             // trace, error message
             CommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
         }
     }
 }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     objCommonMIS.EmpId = Membership.GetUser().UserName;
     if (!Page.IsPostBack)
     {
         taxableAmt = 0.00;
         if (!Roles.GetRolesForUser(objCommonMIS.EmpId).Any(x => (x.Contains("SC") || x.Contains("SC_SIMS"))))
         {
             objCommonMIS.BusinessLine_Sno = "2";
             objCommonMIS.GetUserRegionsMTS_MTO(ddlRegion);
             if (ddlRegion.Items.Count > 0)
             {
                 ddlRegion.SelectedIndex = 0;
             }
             if (ddlRegion.Items.FindByValue("8").Value.Equals("8"))
             {
                 ListItem lstRegion = ddlRegion.Items.FindByValue("8");
                 ddlRegion.Items.Remove(lstRegion);
             }
             objCommonMIS.RegionSno = ddlRegion.SelectedValue;
             objCommonMIS.GetUserBranchs(ddlBranch);
             objCommonMIS.BranchSno = ddlBranch.SelectedValue;
             objCommonMIS.GetUserSCs(ddlSerContractor);
             if (ddlSerContractor.Items.Count == 2)
             {
                 ddlSerContractor.SelectedIndex = 1;
             }
             ddlSerContractor.Visible    = false;
             lblASCShowHide.Visible      = false;
             TrInvoiceHideShow.Visible   = false;
             ShowHideInvoiceDate.Visible = false;
             ClearSearchControl();
         }
         else
         {
             UserMaster objUserMaster = new UserMaster();
             objUserMaster.BindUseronUserName(Membership.GetUser().UserName.ToString(), "SELECT_USER_BY_USRNAME");
             trRB.Visible = false;
             ddlSerContractor.Items.Clear();
             ddlSerContractor.Items.Add(new ListItem(objUserMaster.Name.ToString()));
             ddlSerContractor.SelectedIndex = 0;
             ddlSerContractor.Enabled       = false;
             ddlSerContractor.Visible       = true; // Added by Mukesh  as on 24 Jun 2015
             lblASCShowHide.Visible         = true;
             TrInvoiceHideShow.Visible      = true;
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        //string userRole =  objCommonClass.GetRolesForUser(Membership.GetUser().UserName.ToString());
        objCommonMIS.EmpId = Membership.GetUser().UserName;

        if (!Page.IsPostBack)
        {
            // Bind Year and month
            for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 2; i--)
            {
                Ddlyear.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }
            for (int i = 1; i <= 12; i++)
            {
                ddlMonth.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString()));
            }
            ddlMonth.Items.Insert(0, new ListItem("Select", "0"));

            taxableAmt = 0.00;
            if (!Roles.GetRolesForUser(objCommonMIS.EmpId).Any(x => (x.Contains("SC") || x.Contains("SC_SIMS"))))
            {
                objCommonMIS.BusinessLine_Sno = "2";
                objCommonMIS.GetUserRegionsMTS_MTO(ddlRegion);
                if (ddlRegion.Items.Count > 0)
                {
                    ddlRegion.SelectedIndex = 0;
                }
                //if (ddlRegion.Items.FindByValue("8").Value.Equals("8"))
                //{
                //    ListItem lstRegion = ddlRegion.Items.FindByValue("8");
                //    ddlRegion.Items.Remove(lstRegion);
                //}
                objCommonMIS.RegionSno = ddlRegion.SelectedValue;
                objCommonMIS.GetUserBranchs(ddlBranch);
                objCommonMIS.BranchSno = ddlBranch.SelectedValue;
                objCommonMIS.GetUserSCs(ddlSerContractor);

                if (ddlSerContractor.Items.Count == 2)
                {
                    ddlSerContractor.SelectedIndex = 1;
                }
                //ddlSerContractor.Visible = false;  // Added by Mukesh  as on 24 Jun 2015
                //lblASCShowHide.Visible = false;
                TrInvoiceHideShow.Visible       = false;
                chkServicetaxoption.Visible     = false;
                lblServiceChargesBracks.Visible = false;
                ShowHideInvoiceDate.Visible     = false;
            }
            else
            {
                UserMaster objUserMaster = new UserMaster();
                objUserMaster.BindUseronUserName(Membership.GetUser().UserName.ToString(), "SELECT_USER_BY_USRNAME");
                trRB.Visible = false;
                ddlSerContractor.Items.Clear();
                ddlSerContractor.Items.Add(new ListItem(objUserMaster.Name.ToString()));
                ddlSerContractor.SelectedIndex = 0;
                ddlSerContractor.Enabled       = false;
                ddlSerContractor.Visible       = true; // Added by Mukesh  as on 24 Jun 2015
                lblASCShowHide.Visible         = true;
                TrInvoiceHideShow.Visible      = true;
                //InvoiceDetails();
            }
            ddlMonth.SelectedIndex = 6;
            // imglogo.Visible = false;
        }
    }
    protected void imgSend_Click(object sender, EventArgs e)
    {
        string  strMsg = "", strEmail = "", strUserType = "", strName = "", strUserTypeCode = "";
        DataSet dsUser  = new DataSet();
        bool    blnFlag = false;

        objUserMaster.UserName = txtUsername.Text.Trim();
        dsUser = objUserMaster.BindUseronUserName("SELECT_USER_BY_USRNAME");
        if (dsUser.Tables[0].Rows.Count > 0)
        {
            strEmail        = dsUser.Tables[0].Rows[0]["Email"].ToString();
            strName         = dsUser.Tables[0].Rows[0]["Name"].ToString();
            strUserTypeCode = dsUser.Tables[0].Rows[0]["UserType_Code"].ToString();
            strUserType     = dsUser.Tables[0].Rows[0]["UserType_Name"].ToString();

            if ((strRoleName.ToLower() == "ccadmin") && (strUserTypeCode.ToLower() == "cce"))
            {
                blnFlag = true;
            }
            else if ((strRoleName.ToLower() == "cgadmin") && (strUserTypeCode.ToLower() == "sc"))
            {
                blnFlag = true;
            }
            else if (strRoleName.ToLower() == "super admin")
            {
                blnFlag = true;
            }
            else
            {
                blnFlag = false;
            }

            if ((blnFlag == true) && (strUserTypeCode.ToLower() != "cg"))
            {
                strMsg = objUserMaster.ResetPassword(txtUsername.Text.Trim(), strRoleName, txtPassword.Text.Trim());
                if ((strMsg == "") && (objUserMaster.ReturnValue == 1))
                {
                    if (strEmail != "")
                    {
                        string strBody = "";
                        strBody += "Dear <b>" + strName + "</b>,<br/>Your password has been reset.<br/>Please find your login credentials below:<br/>";
                        strBody += " User Id: " + txtUsername.Text.Trim() + "<br/>";
                        strBody += " Password: "******"<br/>";
                        strBody += " Thanks,<br/>CIC Team";
                        //objCommonClass.SendMailSMTP(strEmail, ConfigurationManager.AppSettings["FromMailId"].ToString(), "Login Details", strBody, true); COMMENT BY Mukesh on 29/Jul/2015
                        SqlParameter[] sqlParam =        // Added by Mukesh Kumar 29/jul/2015
                        {
                            new SqlParameter("@Email", strEmail),
                            new SqlParameter("@body",  strBody)
                        };
                        int suc = ObjSql.ExecuteNonQuery(CommandType.StoredProcedure, "uspSendMailForPassword", sqlParam);
                        lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.RecordUpdated, enuMessageType.UserMessage, true, "Password has been reset and successfully sent to Email: <b>" + strEmail + "</b>");;
                    }
                    else
                    {
                        lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.RecordUpdated, enuMessageType.UserMessage, true, "Password has been reset and new password is: <b>" + txtPassword.Text.Trim() + "</b>");
                    }
                }
            }
            else
            {
                if (strUserTypeCode.ToLower() == "cg")
                {
                    lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.UnableToUpdateDueToRelation, enuMessageType.Warrning, true, "Password cann't be reset for <b>" + strUserType + "</b> employees");
                }
                else
                {
                    lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.UnableToUpdateDueToRelation, enuMessageType.Warrning, true, "You are not authorized to reset password for <b>" + strUserType + "</b> employees");
                }
            }
            txtUsername.Text = "";
        }
        else
        {
            lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.RecordNotFound, enuMessageType.Warrning, true, "User Id: " + txtUsername.Text.Trim() + " doesn't exist");
        }
    }
Beispiel #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //string userRole =  objCommonClass.GetRolesForUser(Membership.GetUser().UserName.ToString());
        objCommonMIS.EmpId = Membership.GetUser().UserName;
        //ddlMonth.Enabled = false;
        Ddlyear.Enabled = false;
        if (!Page.IsPostBack)
        {
            int dt = DateTime.Now.Date.Day;

            if (dt >= 11 && dt <= 27)//// invoice open only these dyas
            {
                // Bind Year and month
                for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 2; i--)
                {
                    Ddlyear.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }

                // uncomment latter
                //for (int i = 1; i <= 12; i++)
                //    ddlMonth.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString()));
                //ddlMonth.Items.Insert(0, new ListItem("Select", "0"));


                for (int i = DateTime.Now.Month - 2; i <= DateTime.Now.Month; i++)
                {
                    ddlMonth.Items.Add(new ListItem(mfi.GetMonthName(i).ToString(), i.ToString()));
                }
                ddlMonth.Items.Insert(0, new ListItem("Select", "0"));



                // by @VT
                //ddlMonth.SelectedValue = Convert.ToString(DateTime.Now.Month - 1);
                // bind amount
                // after sep
                //  BindInvoiveAmount();


                taxableAmt = 0.00;
                if (!Roles.GetRolesForUser(objCommonMIS.EmpId).Any(x => (x.Contains("SC") || x.Contains("SC_SIMS"))))
                {
                    objCommonMIS.BusinessLine_Sno = "2";
                    objCommonMIS.GetUserRegionsMTS_MTO(ddlRegion);
                    if (ddlRegion.Items.Count > 0)
                    {
                        ddlRegion.SelectedIndex = 0;
                    }
                    if (ddlRegion.Items.FindByValue("8").Value.Equals("8"))
                    {
                        ListItem lstRegion = ddlRegion.Items.FindByValue("8");
                        ddlRegion.Items.Remove(lstRegion);
                    }
                    objCommonMIS.RegionSno = ddlRegion.SelectedValue;
                    objCommonMIS.GetUserBranchs(ddlBranch);
                    objCommonMIS.BranchSno = ddlBranch.SelectedValue;
                    objCommonMIS.GetUserSCs(ddlSerContractor);
                    if (ddlSerContractor.Items.Count == 2)
                    {
                        ddlSerContractor.SelectedIndex = 1;
                    }
                    ddlSerContractor.Visible        = false; // Added by Mukesh  as on 24 Jun 2015
                    lblASCShowHide.Visible          = false;
                    TrInvoiceHideShow.Visible       = false;
                    chkServicetaxoption.Visible     = false;
                    lblServiceChargesBracks.Visible = false;
                    ShowHideInvoiceDate.Visible     = false;
                }
                else
                {
                    UserMaster objUserMaster = new UserMaster();
                    objUserMaster.BindUseronUserName(Membership.GetUser().UserName.ToString(), "SELECT_USER_BY_USRNAME");
                    trRB.Visible = false;
                    ddlSerContractor.Items.Clear();
                    ddlSerContractor.Items.Add(new ListItem(objUserMaster.Name.ToString()));
                    ddlSerContractor.SelectedIndex = 0;
                    ddlSerContractor.Enabled       = false;
                    ddlSerContractor.Visible       = true; // Added by Mukesh  as on 24 Jun 2015
                    lblASCShowHide.Visible         = true;
                    TrInvoiceHideShow.Visible      = true;
                    //by @VT 09 Aug 2017
                    //InvoiceDetails();
                }
            }

            else
            {
                Response.Redirect("~/Pages/Default.aspx");
            }
            ddlMonth.SelectedValue = Convert.ToString(DateTime.Now.Month - 1);
        }
        // ddlMonth.SelectedValue = Convert.ToString(DateTime.Now.Month - 1);
        if (Convert.ToInt32(ddlMonth.SelectedValue) > 0)
        {
            lblMnth.Text = mfi.GetMonthName(Convert.ToInt32(ddlMonth.SelectedValue)).ToString() + " " + Ddlyear.SelectedValue;
        }
    }
Beispiel #6
0
    //method to select data on edit
    private void BindSelected(string strUserName)
    {
        objUserMaster.BindUseronUserName(strUserName, "SELECT_USER_BY_USRNAME");
        txtUserEmailId.Text = objUserMaster.EmailId;
        txtUsername.Text    = strUserName;
        txtName.Text        = objUserMaster.Name;
        // Code for selecting Status as in database
        for (intCnt = 0; intCnt < ddlUserType.Items.Count; intCnt++)
        {
            if (ddlUserType.Items[intCnt].Value.ToString().Trim() == objUserMaster.UserType.ToString().Trim())
            {
                ddlUserType.SelectedIndex = intCnt;
            }
        }

        for (intCnt = 0; intCnt < ddlRegion.Items.Count; intCnt++)
        {
            if (ddlRegion.Items[intCnt].Value.ToString().Trim() == objUserMaster.Region.ToString().Trim())
            {
                ddlRegion.SelectedIndex = intCnt;
                objCommonClass.BindUserBranchBasedOnRegion(ddlBranch, int.Parse(objUserMaster.Region.ToString()));
                break;
            }
        }


        for (intCnt = 0; intCnt < ddlBranch.Items.Count; intCnt++)
        {
            if (ddlBranch.Items[intCnt].Value.ToString().Trim() == objUserMaster.Branch.ToString().Trim())
            {
                ddlBranch.SelectedIndex = intCnt;
                break;
            }
        }

        for (intCnt = 0; intCnt < ddlProductDivision.Items.Count; intCnt++)
        {
            if (ddlProductDivision.Items[intCnt].Value.ToString().Trim() == objUserMaster.unit_sno.ToString().Trim())
            {
                ddlProductDivision.SelectedIndex = intCnt;
                break;
            }
        }
        // Code for selecting Status as in database
        for (intCnt = 0; intCnt < rdoStatus.Items.Count; intCnt++)
        {
            if (rdoStatus.Items[intCnt].Value.ToString().Trim() == objUserMaster.ActiveFlag.ToString().Trim())
            {
                rdoStatus.Items[intCnt].Selected = true;
            }
            else
            {
                rdoStatus.Items[intCnt].Selected = false;
            }
        }
        hdnEditType.Value = "Edit";
        Selection();
        if (trTvtUserid.Visible)
        {
            txtTvtUserId.Text = Convert.ToString(objUserMaster.TvtUserId);
        }
    }