Ejemplo n.º 1
0
        /// <summary>
        /// This method is not used.
        /// </summary>
        private bool IsExpired()
        {
            int  x      = 0;
            bool Status = false;

            dbobj.ExecuteScalar("select count(*) from SysTable", ref x);
            if (x <= 0)
            {
                dbobj.Insert_or_Update("insert into SysTable(SysDate1,SysDate2,allow) values(getdate(),dateadd(dd,30,getdate()),'f')", ref x);
            }
            else
            {
                dbobj.Insert_or_Update("if((select SysDate2 from SysTable)<(select getdate())) update SysTable set allow='n'", ref x);
            }
            System.Data.SqlClient.SqlDataReader rdr = null;
            dbobj.SelectQuery("select allow from SysTable", ref rdr);
            if (rdr.Read())
            {
                if (rdr["allow"].Equals("n"))
                {
                    Status = true;
                }
            }
            return(Status);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method is used to update the Role with the help of ProRolesUpdate procedure.
        /// </summary>
        protected void btnUpdate_Click(object sender, System.EventArgs e)
        {
            EmployeeClass obj = new EmployeeClass();

            obj.Role_Name   = txtRoleName.Text.ToString();
            obj.Description = txtDesc.Text.ToString();
            try
            {
                if (dropRoleID.Visible)
                {
                    obj.Role_ID = dropRoleID.SelectedItem.Value;
                    obj.UpdateRoles();
                    CreateLogFiles.ErrorLog("Form:Roles.aspx,Method:btnUpdateClick   Role  name " + obj.Role_Name + " Updated   " + uid);
                    MessageBox.Show("Role Updated");
                }
                else
                {
                    #region Check Role Already Created or Not
                    int count = 0;
                    DBOperations.DBUtil dbobj = new DBOperations.DBUtil();
                    dbobj.ExecuteScalar("select count(*) from Roles where Role_Name='" + txtRoleName.Text.Trim() + "'", ref count);
                    if (count > 0)
                    {
                        MessageBox.Show("Role already Exists");
                        return;
                    }
                    #endregion

                    obj.Role_ID = lblRoleID.Text.ToString();
                    obj.InsertRoles();
                    CreateLogFiles.ErrorLog("Form:Roles.aspx,Method:btnUpdate_Click   Role Name " + obj.Role_Name + " Created   " + uid);
                    MessageBox.Show("Role Created");
                }
                Clear();
                GetNextRoleID();
                lblRoleID.Visible        = true;
                dropRoleID.Visible       = false;
                btnEdit.Visible          = true;
                btnUpdate.Text           = "Save";
                dropRoleID.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                CreateLogFiles.ErrorLog("Form:Roles.aspx,Method:btnUpdate_Click   EXCEPTION: " + ex.Message + " userid   " + uid);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// This method is used to delete the particular Role ID from roles table which role id select from
 /// dropdownlist on edit time.
 /// </summary>
 protected void btnDelete_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (dropRoleID.SelectedIndex == 0)
         {
             RMG.MessageBox.Show("Please select the Role ID");
             return;
         }
         int output = 0;
         DBOperations.DBUtil obj = new DBOperations.DBUtil();
         obj.ExecuteScalar("select count(*) from User_master where Role_ID='" + dropRoleID.SelectedItem.Value + "'", ref output);
         if (output > 0)
         {
             MessageBox.Show("Selected Role cannot be Deleted");
             return;
         }
         else
         {
             obj.Insert_or_Update("delete from roles where Role_Id='" + dropRoleID.SelectedItem.Value + "'", ref output);
             dropRoleID.Items.Remove(dropRoleID.SelectedItem.Value);
             MessageBox.Show("Role Deleted");
             CreateLogFiles.ErrorLog("Form:Roles.aspx,Method: btnDelete_Click" + uid);
             Clear();
             lblRoleID.Visible  = true;
             dropRoleID.Visible = false;
             btnEdit.Visible    = true;
             btnUpdate.Text     = "Save";
             GetNextRoleID();
             dropRoleID.SelectedIndex = 0;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Please select Role ID");
         CreateLogFiles.ErrorLog("Form:Roles.aspx,Method:btnDelete_Click" + ex.Message + "  EXCEPTION  " + uid);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// This method is used to save or update the user details in user master table with the help of
        /// ProUserMasterUpdate and ProUserMasterEntry stored procedure.
        /// </summary>
        protected void btnUpdate_Click(object sender, System.EventArgs e)
        {
            EmployeeClass obj = new EmployeeClass();
            int           x   = 0;

            try
            {
                #region check the username is exist or not?
                dbobj.ExecuteScalar("select count(*) from user_master where loginname='" + txtLoginName.Text.Trim() + "'", ref x);
                if (x > 0)
                {
                    if (dropUserID.Visible)
                    {
                        SqlDataReader SqlDtr = null;
                        string        UserId = "";
                        dbobj.SelectQuery("Select UserID from user_master where loginname='" + txtLoginName.Text.Trim() + "'", ref SqlDtr);
                        if (SqlDtr.Read())
                        {
                            UserId = SqlDtr.GetValue(0).ToString().Trim();
                        }
                        SqlDtr.Close();
                        if (!dropUserID.SelectedItem.Text.Trim().Equals(UserId))
                        {
                            RMG.MessageBox.Show("User " + txtLoginName.Text + " already exists");
                            return;
                        }
                    }
                    else
                    {
                        RMG.MessageBox.Show("User " + txtLoginName.Text + " already exists");
                        return;
                    }
                }
                #endregion
                string Name = "";
                Name           = txtFName.Text;
                Name          += " " + txtMName.Text;
                Name          += " " + txtLName.Text;
                Name           = Name.Trim();
                obj.Login_Name = txtLoginName.Text.ToString();

                obj.Password = Encrypt(txtPassword.Text.ToString(), "!@#$%^");

                //obj.User_Name=txtFName.Text.ToString()+" "+txtMName.Text.ToString()+" "+txtLName.Text.ToString();
                obj.User_Name = Name;
                obj.Role_Name = DropRole.SelectedItem.Value;
                if (dropUserID.Visible)
                {
                    obj.User_ID = dropUserID.SelectedItem.Value;
                    //call the procedure ProUserMasterUpdate to update the required user details in user master table.
                    obj.UpdateUserMaster();
                    CreateLogFiles.ErrorLog("Form:User_Profile.aspx,Method:brnUpdate_Click.  User  ID" + obj.User_ID + " Updated.  User: "******"User Profile Updated");
                }
                else
                {
                    obj.User_ID = lblUserID.Text.ToString();
                    //call the procedure ProUserMasterEntry to insert the user details in user master table.
                    obj.InsertUserMaster();
                    CreateLogFiles.ErrorLog("Form:User_Profile.aspx,Method:brnUpdate_Click. New User With ID " + obj.User_ID + " Created.  User: "******"User Profile Created");
                }

                Clear();
                GetNextUserID();
                lblUserID.Visible  = true;
                btnEdit.Visible    = true;
                dropUserID.Visible = false;
            }
            catch (Exception ex)
            {
                CreateLogFiles.ErrorLog("Form:User_Profile.aspx,Method:Page_load  EXCEPTION: " + ex.Message + "    " + uid);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// This method is used to save the record.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            try
            {
                SqlDataReader SqlDtr = null;
                string        SubGrp = "";
                string        Group  = "";

                if (!checkAcc_Period())
                {
                    MessageBox.Show("Please enter the Accounts Period from Organization Details ");
                    fetchGroup();
                    return;
                }
                dbobj.SelectQuery("select * from ledger_master where ledger_name='" + TxtLedger.Text + "'", ref SqlDtr);
                if (SqlDtr.HasRows)
                {
                    MessageBox.Show("Ledger Name '" + TxtLedger.Text + "' is Allready Exist");
                    return;
                }
                SqlDtr.Close();
                if (DropSub.SelectedItem.Text.Equals("Cash in hand"))
                {
                    dbobj.SelectQuery("select count(*) from ledger_master where sub_grp_id=118", ref SqlDtr);
                    if (SqlDtr.Read())
                    {
                        if (int.Parse(SqlDtr.GetValue(0).ToString()) > 0)
                        {
                            MessageBox.Show("Cash Account Allready Exist");
                            return;
                        }
                    }
                    SqlDtr.Close();
                }

                // Check & Fetch The sub Group
                if (DropSub.SelectedIndex == 0)
                {
                    MessageBox.Show("Please select Sub Group");
                    fetchGroup();
                    return;
                }
                else
                {
                    if (DropSub.SelectedItem.Text == "Other")
                    {
                        if (TxtSub.Text.Trim() == "")
                        {
                            MessageBox.Show("Please specify Other Sub Group");
                            TxtSub.Enabled = true;
                            fetchGroup();
                            return;
                        }
                        else
                        {
                            SubGrp = TxtSub.Text.Trim();
                        }
                    }
                    else
                    {
                        SubGrp = DropSub.SelectedItem.Text.Trim();
                    }
                }

                // Check & Fetch The  Group
                if (txtTempGrp.Value == "Select")
                {
                    MessageBox.Show("Please select Group");
                    fetchGroup();
                    return;
                }
                else
                {
                    if (txtTempGrp.Value == "Other")
                    {
                        if (TxtGroup.Text.Trim() == "")
                        {
                            MessageBox.Show("Please specify Other Group");
                            TxtGroup.Enabled = true;
                            fetchGroup();
                            DropGroup.SelectedIndex = DropGroup.Items.IndexOf(DropGroup.Items.FindByText(txtTempGrp.Value));
                            return;
                        }
                        else
                        {
                            Group = TxtGroup.Text.Trim();
                        }
                    }
                    else
                    {
                        Group = txtTempGrp.Value;
                    }
                }

                string ledgname = "";
                string nature   = "";
                double Op_bal   = 0;
                string bal_type = "";
                ledgname = TxtLedger.Text.Trim();
                string op_bal = "0";
                if (TxtOpeningBal.Text.Trim() != "")
                {
                    op_bal = TxtOpeningBal.Text.Trim();
                }

                Op_bal   = System.Convert.ToDouble(op_bal);
                bal_type = DropBalType.SelectedItem.Text.Trim();

                if (RadioAsset.Checked)
                {
                    nature = "Assets";
                }
                else if (RadioLiab.Checked)
                {
                    nature = "Liabilities";
                }
                else if (RadioExp.Checked)
                {
                    nature = "Expenses";
                }
                else
                {
                    nature = "Income";
                }

                int subgrpid = 0;

                // Get the sub_grp_id for selected Sub_Group Name and Nature Of Payment
                dbobj.SelectQuery("select sub_grp_Id from Ledger_Master_Sub_grp  where sub_grp_name = '" + SubGrp + "' and Nature_Of_group ='" + nature + "' and grp_id = (select top 1 grp_id from mgroup where grp_name = '" + Group + "')", ref SqlDtr);
                if (SqlDtr.Read())
                {
                    subgrpid = System.Convert.ToInt32(SqlDtr["sub_grp_id"].ToString());
                }
                SqlDtr.Close();

                int count = 0;

                // check the Ledger Name is already present for the selected sub group
                dbobj.ExecuteScalar("Select count(Ledger_ID) from Ledger_Master where Ledger_Name = '" + ledgname + "' and Sub_grp_ID = " + subgrpid, ref count);
                if (count > 0)
                {
                    MessageBox.Show("Ledger Name is already exist for selected Sub Group ");
                    fetchGroup();
                    DropGroup.SelectedIndex = DropGroup.Items.IndexOf(DropGroup.Items.FindByText(Group));
                    return;
                }
                else
                {
                    object op = null;
                    dbobj.ExecProc(OprType.Insert, "ProInsertLedger", ref op, "@Ledger_Name", ledgname, "@SubGrp_Name", SubGrp, "@Group_Name", Group, "@Grp_Nature", nature, "@Op_Bal", Op_bal, "@Bal_Type", bal_type);
                }
                MessageBox.Show("Ledger Saved");
                CreateLogFiles.ErrorLog("Form:Ledger Creation,Method:btnSave_Click New Ledger of name " + ledgname + " Saved.  User: "******"Form:Ledger Creation,Method:btnSave_Click Exception: " + ex.Message + "  User: " + uid);
            }
        }