Exemplo 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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method is used to delete the particular record from user master table.
        /// </summary>
        protected void btnDelete_Click(object sender, System.EventArgs e)
        {
            if (dropUserID.SelectedIndex == 0)
            {
                RMG.MessageBox.Show("Please select the User ID");
                return;
            }
            int output = 0;

            try
            {
                DBOperations.DBUtil obj = new DBOperations.DBUtil();
                obj.Insert_or_Update("delete from User_Master where UserID='" + dropUserID.SelectedItem.Value + "'", ref output);
                obj.Insert_or_Update("delete from privileges where User_ID='" + dropUserID.SelectedItem.Value + "'", ref output);
                dropUserID.Items.Remove(dropUserID.SelectedItem.Value);
                MessageBox.Show("User Deleted");
                Clear();
                GetNextUserID();
                lblUserID.Visible  = true;
                btnEdit.Visible    = true;
                dropUserID.Visible = false;
            }
            catch (Exception ex)
            {
                CreateLogFiles.ErrorLog("Form:User_Profile.aspx,Method:btnDelete_Click  EXCEPTION: " + ex.Message + "    " + uid);
            }
        }
 /// <summary>
 /// This method is used to save or update the customer according to ssr in customer table.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSubmit_Click(object sender, System.EventArgs e)
 {
     try
     {
         InventoryClass obj    = new InventoryClass();
         SqlDataReader  SqlDtr = null;
         int            x      = 0;
         string         EmpID  = "";
         string         sql    = "select Emp_ID from Employee where Emp_Name='" + DropSSRName.SelectedItem.Text + "'";
         SqlDtr = obj.GetRecordSet(sql);
         if (SqlDtr.Read())
         {
             EmpID = SqlDtr["Emp_ID"].ToString();
         }
         SqlDtr.Close();
         for (int i = 0; i < ListassignCustomer.Items.Count; ++i)
         {
             ListassignCustomer.SelectedIndex = i;
             string pname = ListassignCustomer.SelectedItem.Value;
             dbobj.Insert_or_Update("update Customer set ssr='" + EmpID + "' where Cust_Name='" + pname + "'", ref x);
         }
         MessageBox.Show("Customer Mapping Update");
         FillList();
         DropSSRName.SelectedIndex = 0;
         ListassignCustomer.Items.Clear();
         CreateLogFiles.ErrorLog("Form:CustomerMapping.aspx,Method:btnSubmit_Click,  Update Customer Mapping,  User  " + uid);
     }
     catch (Exception ex)
     {
         CreateLogFiles.ErrorLog("Form:CustomerMapping.aspx,Method:btnSubmit_Click  EXCEPTION " + ex.Message + "  User  " + uid);
     }
 }
Exemplo n.º 4
0
        public void DeleteTheRec()
        {
            try
            {
                string ledgname1 = "";
                ledgname1 = dropLedgerName.SelectedItem.Text.ToString();
                string[]      strArr = ledgname1.Split(new char[] { ':' }, ledgname1.Length);
                SqlDataReader SqlDtr = null;
                string        id1    = "";
                string        id2    = "";
                // Check  if the Voucher Transaction of the selected Ledger to delete is present or not.
                dbobj.SelectQuery("Select Ledg_ID_Cr, Ledg_ID_Dr from Voucher_Transaction where Ledg_ID_Cr = " + strArr[1].Trim() + " or Ledg_ID_Dr = " + strArr[1].Trim(), ref SqlDtr);
                while (SqlDtr.Read())
                {
                    id1 = SqlDtr["Ledg_ID_Cr"].ToString();
                    id2 = SqlDtr["Ledg_ID_Dr"].ToString();
                }
                SqlDtr.Close();
                if (!id1.Trim().Equals("") || !id2.Trim().Equals(""))
                {
                    MessageBox.Show("Unable to delete Ledger ");
                    fetchGroup();
                    return;
                }
                else
                {
                    int    c = 0, Count = 0;
                    string subgrpid = "";
                    dbobj.SelectQuery("select sub_grp_Id from Ledger_Master where Ledger_id = " + strArr[1].Trim(), ref SqlDtr);
                    while (SqlDtr.Read())
                    {
                        subgrpid = SqlDtr["sub_grp_ID"].ToString();
                    }
                    SqlDtr.Close();

                    dbobj.ExecuteScalar("select count(*) from AccountsLedgerTable where Ledger_id = '" + strArr[1].Trim() + "' and particulars<>'Opening balance'", ref Count);
                    if (Count > 0)
                    {
                        MessageBox.Show("Please Remove The All Transaction Concerning Ledger");
                        return;
                    }

                    dbobj.Insert_or_Update("delete from Ledger_master where Ledger_Id = " + strArr[1].Trim(), ref c);

                    object op = null;
                    dbobj.ExecProc(OprType.Update, "ProUpdatesubgroup", ref op, "@subgrp_id", subgrpid);
                }
                MessageBox.Show("Ledger Deleted");
                CreateLogFiles.ErrorLog("Form:Ledger Creation,Method:btnDelete_Click Ledger  ID " + strArr[1].Trim() + " Deleted.  User: "******"Form:Ledger Creation,Method:btnDelete_Click Exception: " + ex.Message + "  User: " + uid);
            }
        }
Exemplo n.º 5
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);
     }
 }