Exemplo n.º 1
0
    protected void AddMessage_Click(object sender, EventArgs e)
    {
        DBservices dbs = new DBservices();

        try
        {
            string text_message = TBnewMessage.Text;

            dbs.insertNewMessage(text_message);

            Response.Write("<script>alert('נוספה הודעה חדשה במערכת');</script>");
            Response.Redirect("message.aspx");
        }
        catch (Exception ex)
        {
            ErrHandler.WriteError(ex.Message);
            Response.Write("קיימת בעיה אנא נסה שנית מאוחר יותר");
        }
    }
    public void search()
    {
        #region
        SqlConnection  ConnectionString = new SqlConnection(ConfigurationManager.ConnectionStrings["cnstring"].ConnectionString);
        DataTable      ds = new DataTable();
        SqlDataAdapter da;
        try
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "ReportPaging_getLowStockProduct";
            cmd.CommandType = CommandType.StoredProcedure;
            if (txtSearch.Text == "")
            {
                cmd.Parameters.Add("@seachtext", null);
            }
            else
            {
                cmd.Parameters.Add("@seachtext", txtSearch.Text);
            }

            cmd.Connection = ConnectionString;
            ConnectionString.Open();
            da = new SqlDataAdapter(cmd);
            da.Fill(ds);


            lbPrevious.Enabled = true;
            lbNext.Enabled     = false;
            lbFirst.Enabled    = true;
            lbLast.Enabled     = false;
            //CurrentPage = 0;
        }
        catch (Exception ex)
        {
            ErrHandler.writeError(ex.Message, ex.StackTrace);
        }
        finally
        {
            ConnectionString.Close();
        }
        BindDataIntoRepeater(ds);
        #endregion
    }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the RowCommand event of the gvActasValidacion control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridViewCommandEventArgs"/> instance containing the event data.</param>
        protected void gvActasValidacion_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("eliminar"))
            {
                if (e.CommandArgument != null)
                {
                    try
                    {
                        int idActa = Convert.ToInt32(e.CommandArgument);

                        ActaFinalDeValidacion.EliminarActaValidacionYProyectos(idActa);

                        gvActasValidacion.DataBind();
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('Sucedio un error al eliminar el acta, intentelo de nuevo.');", true);

                        string url = Request.Url.ToString();

                        string mensaje        = ex.Message.ToString();
                        string data           = ex.Data.ToString();
                        string stackTrace     = ex.StackTrace.ToString();
                        string innerException = ex.InnerException == null ? "" : ex.InnerException.Message.ToString();

                        // Log the error
                        ErrHandler.WriteError(mensaje, url, data, stackTrace, innerException, usuario.Email, usuario.IdContacto.ToString());
                    }
                }
            }
            else if (e.CommandName.Equals("actualizar"))
            {
                if (e.CommandArgument != null)
                {
                    int idActa = Convert.ToInt32(e.CommandArgument.ToString().Split(';')[0]);

                    Session["idacta"]    = idActa;
                    Session["publicado"] = e.CommandArgument.ToString().Split(';')[1];

                    Response.Redirect("CrearActa.aspx");
                }
            }
        }
Exemplo n.º 4
0
    protected void saveOrder(object sender, EventArgs e)
    {
        try
        {
            workerName = (string)(Session["Name"]);
            password   = (string)(Session["Password"]);
            status     = "open";
            OrderDate  = (string)(Session["OrderDate"]);

            workerID = dbs.getWorkerID(workerName, password);
            Branch   = dbs.getWorkerBranch(workerID);

            dbs.insertOrder(status, OrderDate, workerID, Branch);
            string poId = dbs.getPO_ID();

            int i = 0;
            foreach (Item x in listOfItem)
            {
                string  ObjID = "objBox" + i;
                TextBox Box   = (TextBox)tb.FindControl(ObjID);

                double num;
                bool   isNum = double.TryParse(Box.Text, out num);

                if (Box.Text != "" && Box.Text != Convert.ToString(0) && isNum == true)
                {
                    SN       = x.Serialnumber;
                    Quantity = Convert.ToInt32(Box.Text);
                    dbs.insertItemOrder(poId, SN, Quantity);
                }
                i++;
            }

            tb.Visible           = false;
            saveBTN.Visible      = false;
            massageOrder.Visible = true;
        }
        catch (Exception ex)
        {
            ErrHandler.WriteError(ex.Message);
            Response.Write("ארעה שגיאה");
        }
    }
Exemplo n.º 5
0
 public void search()
 {
     #region
     SqlConnection  ConnectionString = new SqlConnection(ConfigurationManager.ConnectionStrings["cnstring"].ConnectionString);
     DataTable      ds = new DataTable();
     SqlDataAdapter da;
     try
     {
         SqlCommand cmd = new SqlCommand();
         cmd.CommandText = "ReportPaging_IndividualCustomerLedger";
         cmd.CommandType = CommandType.StoredProcedure;
         // cmd.Parameters.AddWithValue("@seachtext", txttsearch.Text.Trim());
         string dd = ddlUserType.SelectedValue.ToString().ToUpper().Trim();
         cmd.Parameters.AddWithValue("@userType", ddlUserType.SelectedValue.ToString().ToUpper().Trim());
         cmd.Parameters.AddWithValue("@id", ddlUserName.SelectedValue.ToString().ToUpper().Trim());
         cmd.Connection = ConnectionString;
         ConnectionString.Open();
         da = new SqlDataAdapter(cmd);
         da.Fill(ds);
         if (ds != null)
         {
             if (ds.Rows.Count > 0)
             {
                 Session["dtProduct"] = ds;
             }
         }
         lbPrevious.Enabled = true;
         lbNext.Enabled     = false;
         lbFirst.Enabled    = true;
         lbLast.Enabled     = false;
         //CurrentPage = 0;
     }
     catch (Exception ex)
     {
         ErrHandler.writeError(ex.Message, ex.StackTrace);
     }
     finally
     {
         ConnectionString.Close();
     }
     BindDataIntoRepeater(ds);
     #endregion
 }
Exemplo n.º 6
0
        public Int64 Update(Customer_orders objorders)
        {
            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "Customer_orders_Update";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@oid";
                param.Value         = objorders.oid;
                param.SqlDbType     = SqlDbType.BigInt;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@uid", objorders.uid);
                cmd.Parameters.AddWithValue("@productquantites", objorders.productquantites);
                cmd.Parameters.AddWithValue("@billpaidornot", objorders.billpaidornot);
                cmd.Parameters.AddWithValue("@amount", objorders.amount);
                cmd.Parameters.AddWithValue("@discount", objorders.discount);
                cmd.Parameters.AddWithValue("@tax", objorders.tax);
                cmd.Parameters.AddWithValue("@totalamount", objorders.totalamount);
                cmd.Parameters.AddWithValue("@orderdate", objorders.orderdate);



                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            DBservices    dbs        = new DBservices();
            List <string> itemVendor = new List <string>();
            itemVendor = dbs.getVendorName();

            foreach (string name in itemVendor)
            {
                DDvandor.Items.Add(name);
            }
        }
        catch (Exception ex)
        {
            ErrHandler.WriteError(ex.Message);
            Response.Write("ארעה שגיאה");
        }
    }
        public Int64 Insert(deliveryboyMaster objVendorMaster)
        {
            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "deliveryboy_Insert";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@id";
                param.Value         = objVendorMaster.id;
                param.SqlDbType     = SqlDbType.Int;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@Name", objVendorMaster.Name);
                cmd.Parameters.AddWithValue("@Address1", objVendorMaster.Address1);
                cmd.Parameters.AddWithValue("@MobileNo1", objVendorMaster.MobileNo1);
                cmd.Parameters.AddWithValue("@email", objVendorMaster.email);
                cmd.Parameters.AddWithValue("@landline", objVendorMaster.landline);
                cmd.Parameters.AddWithValue("@img", objVendorMaster.img);
                cmd.Parameters.AddWithValue("@password", objVendorMaster.password);
                cmd.Parameters.AddWithValue("@latitude", objVendorMaster.latitude);
                cmd.Parameters.AddWithValue("@loginitude", objVendorMaster.loginitude);


                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
Exemplo n.º 9
0
    protected void ButtonNewPatient_Click(object sender, EventArgs e)
    {
        try
        {
            DBservices dbs    = new DBservices();
            string     Name   = TBPatientName.Text;
            string     ID     = TBPatientId.Text;
            string     Num    = TBPatientNum.Text;
            string     Kupah  = (DDPatientKupah.SelectedItem).ToString();
            string     Zantar = (DDPatientZantar.SelectedItem).ToString();

            if (Zantar == "כן")
            {
                Zantar = "1";
            }
            else
            {
                Zantar = "0";
            }

            string needle      = (DDneedle.SelectedItem).ToString();
            string coil        = (DDcoil.SelectedItem).ToString();
            string infusionBag = (DDinfusionBag.SelectedItem).ToString();
            string solutions   = (DDsolutions.SelectedItem).ToString();


            string USERname   = (string)(Session["Name"]);
            string USERpass   = (string)(Session["Password"]);
            string USERid     = dbs.getWorkerID(USERname, USERpass);
            string USERbranch = dbs.getWorkerBranch(USERid);


            dbs.insertNewPatient(ID, Kupah, Num, Name, Zantar, USERbranch, needle, coil, infusionBag, solutions);
            Response.Write("<script>alert('המטופל נשמר בהצלחה');</script>");
            Response.Redirect("PatientList.aspx");
        }
        catch (Exception ex)
        {
            ErrHandler.WriteError(ex.Message);
            Response.Write("קיימת בעיה אנא נסה שנית מאוחר יותר");
        }
    }
Exemplo n.º 10
0
        public Int64 Update(employeewagesMaster objcategory)
        {
            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "employeewages_Update";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@id";
                param.Value         = objcategory.id;
                param.SqlDbType     = SqlDbType.BigInt;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@firstcount", objcategory.firstcount);
                cmd.Parameters.AddWithValue("@firstrate", objcategory.firstrate);
                cmd.Parameters.AddWithValue("@secondrate", objcategory.secondrate);
                cmd.Parameters.AddWithValue("@vshaperate", objcategory.vshaperate);
                cmd.Parameters.AddWithValue("@silairate", objcategory.silairate);
                cmd.Parameters.AddWithValue("@currentfirstrate", objcategory.currentfirstrate);
                cmd.Parameters.AddWithValue("@currentsecondrate", objcategory.currentsecondrate);
                cmd.Parameters.AddWithValue("@currentvshaperate", objcategory.currentvshaperate);
                cmd.Parameters.AddWithValue("@currentsilairate", objcategory.currentsilairate);

                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
Exemplo n.º 11
0
    public void search()
    {
        #region
        SqlConnection  ConnectionString = new SqlConnection(ConfigurationManager.ConnectionStrings["cnstring"].ConnectionString);
        DataTable      ds = new DataTable();
        SqlDataAdapter da;
        try
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "ReportPaging_SalesReport";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@from", txt_fromDate.Text.Trim());
            cmd.Parameters.AddWithValue("@to", txt_toDate.Text.Trim());

            cmd.Connection = ConnectionString;
            ConnectionString.Open();
            da = new SqlDataAdapter(cmd);
            da.Fill(ds);
            if (ds != null)
            {
                if (ds.Rows.Count > 0)
                {
                    Session["dtProduct"] = ds;
                }
            }
            lbPrevious.Enabled = true;
            lbNext.Enabled     = false;
            lbFirst.Enabled    = true;
            lbLast.Enabled     = false;
            //CurrentPage = 0;
        }
        catch (Exception ex)
        {
            ErrHandler.writeError(ex.Message, ex.StackTrace);
        }
        finally
        {
            ConnectionString.Close();
        }
        BindDataIntoRepeater(ds);
        #endregion
    }
        public Int64 Insert(AgentMaster objAgentMaster)
        {
            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "agentmaster_Insert";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;



                SqlParameter param = new SqlParameter();
                param.ParameterName = "@aid";
                param.Value         = objAgentMaster.aid;
                param.SqlDbType     = SqlDbType.Int;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@Agentname", objAgentMaster.Agentname);
                cmd.Parameters.AddWithValue("@Address", objAgentMaster.Address);
                cmd.Parameters.AddWithValue("@MobileNo", objAgentMaster.MobileNo);
                cmd.Parameters.AddWithValue("@email", objAgentMaster.email);
                cmd.Parameters.AddWithValue("@img", objAgentMaster.img);



                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
        /*
         * public DataTable SelectAllAdmin()
         * {
         *  DataSet ds = new DataSet();
         *  SqlDataAdapter da;
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "farmercollection_SelectAllAdmin";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return ds.Tables[0];
         * }
         *
         * public DataTable SelectAll()
         * {
         *  DataSet ds = new DataSet();
         *  SqlDataAdapter da;
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "farmercollection_SelectAll";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return ds.Tables[0];
         * }
         *
         * public DataTable farmercollection_WSSelectAll()
         * {
         *  DataSet ds = new DataSet();
         *  SqlDataAdapter da;
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "farmercollection_WSSelectAll";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return ds.Tables[0];
         * }
         * public bool Delete(Int64 id)
         * {
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "farmercollection_Delete";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *
         *      cmd.Parameters.AddWithValue("@id", id);
         *
         *      ConnectionString.Open();
         *      cmd.ExecuteNonQuery();
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return false;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return true;
         * }
         *
         * public bool farmercollection_IsActive(Int64 farmercollectionId, Boolean IsActive)
         * {
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "farmercollection_IsActive";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      cmd.Parameters.AddWithValue("@id", farmercollectionId);
         *      //cmd.Parameters.AddWithValue("@isactive", IsActive);
         *      ConnectionString.Open();
         *      cmd.ExecuteNonQuery();
         *  }
         *  catch (Exception)
         *  {
         *      return false;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return true;
         * }
         *
         *  public DataTable farmercollection_WSSelectById(Int64 id)
         * {
         *  DataSet ds = new DataSet();
         *  SqlDataAdapter da;
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "farmercollection_WSSelectById";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      cmd.Parameters.AddWithValue("@id", id);
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return ds.Tables[0];
         * }
         *
         *   public Int64 Update(farmercollection objfarmercollection)
         * {
         *  Int64 result = 0;
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "farmercollection_Update";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *
         *      SqlParameter param = new SqlParameter();
         *      param.ParameterName = "@id";
         *      param.Value = objfarmercollection.id;
         *      param.SqlDbType = SqlDbType.BigInt;
         *      param.Direction = ParameterDirection.InputOutput;
         *      cmd.Parameters.Add(param);
         *      cmd.Parameters.AddWithValue("farmerid", objfarmercollection.farmerid);
         *      cmd.Parameters.AddWithValue("productid", objfarmercollection.productid);
         *      cmd.Parameters.AddWithValue("rate", objfarmercollection.rate);
         *
         *      ConnectionString.Open();
         *      cmd.ExecuteNonQuery();
         *      result = Convert.ToInt64(param.Value);
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return result;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return result;
         * }
         *
         *  public DataTable SelectByFarmerId(Int64 id)
         * {
         *  DataSet ds = new DataSet();
         *  SqlDataAdapter da;
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "farmercollection_SelectByFarmerId";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *
         *      SqlParameter param = new SqlParameter();
         *      param.ParameterName = "@id";
         *      param.Value = id;
         *      param.SqlDbType = SqlDbType.BigInt;
         *      param.Direction = ParameterDirection.Input;
         *      cmd.Parameters.Add(param);
         *
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return ds.Tables[0];
         * }
         *
         *
         */



        public Int64 Insert(farmercollection objfarmercollection)
        {
            Int64 result = 0;

            try
            {
                //id, farmerid, productid, quantity, rate, createddate, isdeleted

                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "farmercollection_Insert";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@id";
                param.Value         = objfarmercollection.id;
                param.SqlDbType     = SqlDbType.BigInt;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);


                cmd.Parameters.AddWithValue("farmerid", objfarmercollection.farmerid);
                cmd.Parameters.AddWithValue("productid", objfarmercollection.productid);
                cmd.Parameters.AddWithValue("quantity", objfarmercollection.quantity);
                cmd.Parameters.AddWithValue("rate", objfarmercollection.rate);


                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
        public Int64 Update(newsupdate objnewsupdate)
        {
            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "newsupdate_Update";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@newsupdateid";
                param.Value         = objnewsupdate.newsupdateid;
                param.SqlDbType     = SqlDbType.BigInt;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@title", objnewsupdate.title);
                cmd.Parameters.AddWithValue("@imagename", objnewsupdate.imagename);
                cmd.Parameters.AddWithValue("@shortdescp", objnewsupdate.shortdescp);
                cmd.Parameters.AddWithValue("@longdescp", objnewsupdate.longdescp);
                cmd.Parameters.AddWithValue("@newsdate", objnewsupdate.newsdate);
                cmd.Parameters.AddWithValue("@imagename2", objnewsupdate.imagename2);
                cmd.Parameters.AddWithValue("@imagename3", objnewsupdate.imagename3);
                cmd.Parameters.AddWithValue("@imagename4", objnewsupdate.imagename4);
                cmd.Parameters.AddWithValue("@imagename5", objnewsupdate.imagename5);

                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
Exemplo n.º 15
0
        /*
         * public DataTable SelectAll()
         * {
         *  DataSet ds = new DataSet();
         *  SqlDataAdapter da;
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "creditnotes_SelectAll";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return ds.Tables[0];
         * }
         *
         *
         * public creditnotes SelectById(Int64 oid)
         * {
         *  SqlDataAdapter da;
         *  DataSet ds = new DataSet();
         *  creditnotes objcreditnotes = new creditnotes();
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "creditnotes_SelectById";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      cmd.Parameters.AddWithValue("@o" +
         *          "id", oid);
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *
         *      if (ds != null)
         *      {
         *          if (ds.Tables.Count > 0)
         *          {
         *              if (ds.Tables[0] != null)
         *              {
         *                  if (ds.Tables[0].Rows.Count > 0)
         *                  {
         *                      {
         *                          objcreditnotes.oid = Convert.ToInt64(ds.Tables[0].Rows[0]["oid"]);
         *                          objcreditnotes.uid = Convert.ToInt64(ds.Tables[0].Rows[0]["uid"]);
         *                          objcreditnotes.productquantites = Convert.ToInt32(ds.Tables[0].Rows[0]["productquantites"]);
         *                          objcreditnotes.billpaidornot = string.IsNullOrEmpty(ds.Tables[0].Rows[0]["billpaidornot"].ToString()) ? false : Convert.ToBoolean(ds.Tables[0].Rows[0]["billpaidornot"]);
         *                          objcreditnotes.amount = Convert.ToDecimal(ds.Tables[0].Rows[0]["amount"]);
         *                          objcreditnotes.discount = Convert.ToDecimal(ds.Tables[0].Rows[0]["discount"]);
         *                          objcreditnotes.tax = Convert.ToDecimal(ds.Tables[0].Rows[0]["tax"]);
         *                          objcreditnotes.totalamount = Convert.ToDecimal(ds.Tables[0].Rows[0]["totalamount"]);
         *                          objcreditnotes.orderdate = string.IsNullOrEmpty(ds.Tables[0].Rows[0]["orderdate"].ToString()) ? DateTime.MinValue : Convert.ToDateTime(ds.Tables[0].Rows[0]["orderdate"]);
         *                          objcreditnotes.isdelete = string.IsNullOrEmpty(ds.Tables[0].Rows[0]["isdelete"].ToString()) ? false : Convert.ToBoolean(ds.Tables[0].Rows[0]["isdelete"]);
         *                      }
         *                  }
         *              }
         *          }
         *      }
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return objcreditnotes;
         * }
         */


        public Int64 Insert(creditnotes objcreditnotes)
        {
            //id, customerid, invoiceid, reason, disctypepercentage, amount, freightdiscount, createddate, isdeleted

            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "creditnotes_Insert";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@id";
                param.Value         = objcreditnotes.id;
                param.SqlDbType     = SqlDbType.BigInt;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@customerid", objcreditnotes.customerid);
                cmd.Parameters.AddWithValue("@invoiceid", objcreditnotes.invoiceid);
                cmd.Parameters.AddWithValue("@reason", objcreditnotes.reason);
                cmd.Parameters.AddWithValue("@disctypepercentage", objcreditnotes.disctypepercentage);
                cmd.Parameters.AddWithValue("@amount", objcreditnotes.amount);
                cmd.Parameters.AddWithValue("@freightdiscount", objcreditnotes.freightdiscount);
                cmd.Parameters.AddWithValue("@otheramount", objcreditnotes.otheramount);

                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
Exemplo n.º 16
0
 public bool Product_UpdatePrice(Int64 ProductId, decimal CustomerPrice, decimal DealerPrice, decimal DiscountPrice, decimal GST, Int32 StockQuantites, bool IsStock, bool IsActive, decimal Wholesaleprice, decimal SuperWholesaleprice, int StockAlertQuantites, bool isHotproduct)
 {
     try
     {
         Cls_product_db objCls_product_db = new Cls_product_db();
         if (objCls_product_db.Product_UpdatePrice(ProductId, CustomerPrice, DealerPrice, DiscountPrice, GST, StockQuantites, IsStock, IsActive, Wholesaleprice, SuperWholesaleprice, StockAlertQuantites, isHotproduct))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         ErrHandler.writeError(ex.Message, ex.StackTrace);
         return(false);
     }
 }
Exemplo n.º 17
0
    protected void DeletButton_Click(object sender, EventArgs e)
    {
        try
        {
            DBservices dbs = new DBservices();

            Label  lSN      = (Label)PHIteamNS.FindControl("lbSN");
            string SN       = lSN.Text;
            string numinbox = TBNumInBox.Text;
            string price    = TBPrice.Text;

            dbs.DeletItem(SN);
            Response.Redirect("itamList.aspx");
        }
        catch (Exception ex)
        {
            ErrHandler.WriteError(ex.Message);
            Response.Write("קיימת בעיה אנא נסה שנית מאוחר יותר");
        }
    }
Exemplo n.º 18
0
    protected void ButtonNewWorker_Click(object sender, EventArgs e)
    {
        DBservices dbs = new DBservices();

        try
        {
            string Name  = TBworkerName.Text;
            string ID    = TBworkerID.Text;
            string Pass  = TBworkerPass.Text;
            string Title = (DDLworkerTitle.SelectedItem).ToString();
            dbs.insertNewWorker(Name, ID, Pass, Title);

            Response.Write("<script>alert('העובד נקלט במערכת בהצלחה');</script>");
        }
        catch (Exception ex)
        {
            ErrHandler.WriteError(ex.Message);
            Response.Write("קיימת בעיה אנא נסה שנית מאוחר יותר");
        }
    }
Exemplo n.º 19
0
        public Int64 Update(category objcategory)
        {
            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "category_Update";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@cid";
                param.Value         = objcategory.cid;
                param.SqlDbType     = SqlDbType.BigInt;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@categoryname", objcategory.categoryname);
                cmd.Parameters.AddWithValue("@imagename", objcategory.imagename);
                cmd.Parameters.AddWithValue("@actualprice", objcategory.actualprice);
                cmd.Parameters.AddWithValue("@discountprice", objcategory.discountprice);
                cmd.Parameters.AddWithValue("@shortdesc", objcategory.shortdesc);
                cmd.Parameters.AddWithValue("@longdescp", objcategory.longdescp);
                //cmd.Parameters.AddWithValue("@bankid", objcategory.bankid);
                cmd.Parameters.AddWithValue("@maincategoryid", objcategory.maincategoryid);

                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
        public Int64 Update(orderproducts objorderproducts)
        {
            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "orderproducts_Update";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@opid";
                param.Value         = objorderproducts.opid;
                param.SqlDbType     = SqlDbType.BigInt;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@oid", objorderproducts.oid);
                cmd.Parameters.AddWithValue("@uid", objorderproducts.uid);
                cmd.Parameters.AddWithValue("@pid", objorderproducts.pid);
                cmd.Parameters.AddWithValue("@productprice", objorderproducts.productprice);
                cmd.Parameters.AddWithValue("@gst", objorderproducts.gst);
                cmd.Parameters.AddWithValue("@discount", objorderproducts.discount);
                cmd.Parameters.AddWithValue("@productafterdiscountprice", objorderproducts.discount);
                cmd.Parameters.AddWithValue("@quantites", objorderproducts.quantites);

                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
Exemplo n.º 21
0
        public Int64 Insert(collectiontrip objcollectiontrip)
        {
            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "collectiontrip_Insert";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;


                // id, weekday, cityname, empid, empname, isdeleted

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@id";
                param.Value         = objcollectiontrip.id;
                param.SqlDbType     = SqlDbType.Int;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@weekday", objcollectiontrip.weekday);
                cmd.Parameters.AddWithValue("@cityname", objcollectiontrip.cityname);
                cmd.Parameters.AddWithValue("@empid", objcollectiontrip.empid);



                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
        /*
         * public DataTable SelectAll_Admin()
         * {
         *  DataSet ds = new DataSet();
         *  SqlDataAdapter da;
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "articleproduction_SelectAllAdmin";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return ds.Tables[0];
         * }
         *
         * public DataTable SelectAll()
         * {
         *  DataSet ds = new DataSet();
         *  SqlDataAdapter da;
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "articleproduction_SelectAll";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return ds.Tables[0];
         * }
         *
         * public articleproduction SelectById(Int64 bankid)
         * {
         *  SqlDataAdapter da;
         *  DataSet ds = new DataSet();
         *  articleproduction objarticleproduction = new articleproduction();
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "articleproduction_SelectById";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      cmd.Parameters.AddWithValue("@bankid", bankid);
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *
         *      if (ds != null)
         *      {
         *          if (ds.Tables.Count > 0)
         *          {
         *              if (ds.Tables[0] != null)
         *              {
         *                  if (ds.Tables[0].Rows.Count > 0)
         *                  {
         *                      {
         *
         *                          objarticleproduction.bankid = Convert.ToInt32(ds.Tables[0].Rows[0]["bankid"]);
         *                          objarticleproduction.bankname = Convert.ToString(ds.Tables[0].Rows[0]["bankname"]);
         *                          objarticleproduction.bankifsccode = Convert.ToString(ds.Tables[0].Rows[0]["bankifsccode"]);
         *                          objarticleproduction.bankbranch = Convert.ToString(ds.Tables[0].Rows[0]["bankbranch"]);
         *                          objarticleproduction.accountno = Convert.ToString(ds.Tables[0].Rows[0]["accountno"]);
         *                          objarticleproduction.accountholdername = Convert.ToString(ds.Tables[0].Rows[0]["accountholdername"]);
         *                          objarticleproduction.balance = Convert.ToDecimal(ds.Tables[0].Rows[0]["balance"]);
         *
         *                      }
         *                  }
         *              }
         *          }
         *      }
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return objarticleproduction;
         * }
         *
         */

        public Int64 Insert(articleproduction objarticleproduction)
        {
            //id, worksheetno, employeeid, totalpairs, vshape, silai, factorysecond, isdeleted, createddate

            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "articleproduction_Insert";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@id";
                param.Value         = objarticleproduction.id;
                param.SqlDbType     = SqlDbType.Int;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@worksheetno", objarticleproduction.worksheetno);
                cmd.Parameters.AddWithValue("@employeeid", objarticleproduction.employeeid);
                cmd.Parameters.AddWithValue("@totalpairs", objarticleproduction.totalpairs);
                cmd.Parameters.AddWithValue("@vshape", objarticleproduction.vshape);
                cmd.Parameters.AddWithValue("@silai", objarticleproduction.silai);
                cmd.Parameters.AddWithValue("@factorysecond", objarticleproduction.factorysecond);

                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
        /// <summary>
        /// Handles the Selecting event of the lds_listaCoordEval control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="LinqDataSourceSelectEventArgs"/> instance containing the event data.</param>
        protected void lds_listaCoordEval_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            try
            {
                var query = from P in consultas.Db.MD_VerContratosEvaluador(Convert.ToInt32(CodEvaluador))
                            select P;
                e.Result = query;
            }
            catch (Exception ex)
            {
                string url = Request.Url.ToString();

                string mensaje        = ex.Message.ToString();
                string data           = ex.Data.ToString();
                string stackTrace     = ex.StackTrace.ToString();
                string innerException = ex.InnerException == null ? "" : ex.InnerException.Message.ToString();

                // Log the error
                ErrHandler.WriteError(mensaje, url, data, stackTrace, innerException, usuario.Email, usuario.IdContacto.ToString());
            }
        }
Exemplo n.º 24
0
        public ReturnObject VerifyMobile(string mobile, string OTP)
        {
            ReturnObject returnData = new ReturnObject();

            try
            {
                using (ddiarydbEntities db = new ddiarydbEntities())
                {
                    var result = db.OTPVerifications.FirstOrDefault(x => x.MobileNo == mobile);
                    if (result != null)
                    {
                        if (result.OTP == OTP)
                        {
                            result.OTP             = "";
                            returnData.message     = "Successfull";
                            returnData.status_code = Convert.ToInt32(Status.Sucess);
                            returnData.data1       = result;
                        }
                        else
                        {
                            returnData.message     = "Please enter correct OTP.";
                            returnData.status_code = Convert.ToInt32(Status.Failed);
                        }
                    }
                    else
                    {
                        returnData.message     = "Oops something went wrong!";
                        returnData.status_code = Convert.ToInt32(Status.Failed);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrHandler.WriteError(ex.Message, ex);
                returnData.data1       = ex;
                returnData.message     = "Oops something went wrong! ";
                returnData.status_code = Convert.ToInt32(Status.Failed);
            }
            return(returnData);
        }
Exemplo n.º 25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                DataTable dt = new DataTable();

                dt = DBservices.GetBranches();

                ddlBranches.DataSource     = dt;
                ddlBranches.DataTextField  = "Name";
                ddlBranches.DataValueField = "B_ID";
                ddlBranches.DataBind();
            }
            catch (Exception ex)
            {
                ErrHandler.WriteError(ex.Message);
                Response.Write("ארעה שגיאה");
            }
        }
    }
        public Int64 Update(bankmaster objbankmaster)
        {
            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "bankmaster_Update";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@bankid";
                param.Value         = objbankmaster.bankid;
                param.SqlDbType     = SqlDbType.Int;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@bankname", objbankmaster.bankname);
                cmd.Parameters.AddWithValue("@bankifsccode", objbankmaster.bankifsccode);
                cmd.Parameters.AddWithValue("@bankbranch", objbankmaster.bankbranch);
                cmd.Parameters.AddWithValue("@accountno", objbankmaster.accountno);
                cmd.Parameters.AddWithValue("@accountholdername", objbankmaster.accountholdername);
                cmd.Parameters.AddWithValue("@balance", objbankmaster.balance);

                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
Exemplo n.º 27
0
    protected void addIteam_Click(object sender, EventArgs e)
    {
        try
        {
            DBservices dbs      = new DBservices();
            string     Name     = TBNameItem.Text;
            string     sn       = TBsn.Text;
            string     catrgory = (DDCatgory.SelectedItem).ToString();
            string     numINbox = TBNumInBox.Text;
            string     price    = TBPrice.Text;
            string     vandorsn = dbs.getVendorSN((DDvandor.SelectedItem).ToString());


            dbs.insertNewIteam(Name, sn, catrgory, numINbox, price, vandorsn);
            Response.Write("<script>alert('פריט נשמר בהצלחה');</script>");
        }
        catch (Exception ex)
        {
            ErrHandler.WriteError(ex.Message);
            Response.Write("קיימת בעיה אנא נסה שנית מאוחר יותר");
        }
    }
        /// <summary>
        /// Purpose: Send OTP
        /// Created By: Vishal Chudasama on 25 Aug 2020
        /// </summary>
        /// <returns> OTP </returns>
        /// <param name="mobile"> Mobile No. </param>

        public JsonResult SendOTP(string mobile)
        {
            ReturnObject returnData = new ReturnObject();

            try
            {
                using (ddiarydbEntities db = new ddiarydbEntities())
                {
                    //var result = db.OTPVerifications.FirstOrDefault(x => x.MobileNo == mobile);
                    //if (result != null)
                    //{
                    //    //returnData.message = "Successfull";
                    //    //returnData.status_code = Convert.ToInt32(Status.Sucess);
                    //    //returnData.data1 = result.OTP;

                    //    returnData = new DoctorController().SendOTP("", mobile, result.OTP);
                    //}
                    //else
                    //{
                    string OTP = "";

                    Random r = new Random();

                    OTP = r.Next(1000, 9999).ToString();

                    returnData = new DoctorController().SendOTP("", mobile, OTP);
                    //}
                }
            }
            catch (Exception ex)
            {
                ErrHandler.WriteError(ex.Message, ex);
                returnData.data1       = ex;
                returnData.message     = "Oops something went wrong! ";
                returnData.status_code = Convert.ToInt32(Status.Failed);
            }

            return(Json(JsonConvert.SerializeObject(returnData), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 29
0
        /*
         * public DataTable SelectAll_Admin()
         * {
         *  DataSet ds = new DataSet();
         *  SqlDataAdapter da;
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "articlestock_SelectAllAdmin";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return ds.Tables[0];
         * }
         *
         * public DataTable SelectAll()
         * {
         *  DataSet ds = new DataSet();
         *  SqlDataAdapter da;
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "articlestock_SelectAll";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return ds.Tables[0];
         * }
         *
         * public articlestock SelectById(Int64 bankid)
         * {
         *  SqlDataAdapter da;
         *  DataSet ds = new DataSet();
         *  articlestock objarticlestock = new articlestock();
         *  try
         *  {
         *      SqlCommand cmd = new SqlCommand();
         *      cmd.CommandText = "articlestock_SelectById";
         *      cmd.CommandType = CommandType.StoredProcedure;
         *      cmd.Connection = ConnectionString;
         *      cmd.Parameters.AddWithValue("@bankid", bankid);
         *      ConnectionString.Open();
         *      da = new SqlDataAdapter(cmd);
         *      da.Fill(ds);
         *
         *      if (ds != null)
         *      {
         *          if (ds.Tables.Count > 0)
         *          {
         *              if (ds.Tables[0] != null)
         *              {
         *                  if (ds.Tables[0].Rows.Count > 0)
         *                  {
         *                      {
         *
         *                          objarticlestock.bankid = Convert.ToInt32(ds.Tables[0].Rows[0]["bankid"]);
         *                          objarticlestock.bankname = Convert.ToString(ds.Tables[0].Rows[0]["bankname"]);
         *                          objarticlestock.bankifsccode = Convert.ToString(ds.Tables[0].Rows[0]["bankifsccode"]);
         *                          objarticlestock.bankbranch = Convert.ToString(ds.Tables[0].Rows[0]["bankbranch"]);
         *                          objarticlestock.accountno = Convert.ToString(ds.Tables[0].Rows[0]["accountno"]);
         *                          objarticlestock.accountholdername = Convert.ToString(ds.Tables[0].Rows[0]["accountholdername"]);
         *                          objarticlestock.balance = Convert.ToDecimal(ds.Tables[0].Rows[0]["balance"]);
         *
         *                      }
         *                  }
         *              }
         *          }
         *      }
         *  }
         *  catch (Exception ex)
         *  {
         *      ErrHandler.writeError(ex.Message, ex.StackTrace);
         *      return null;
         *  }
         *  finally
         *  {
         *      ConnectionString.Close();
         *  }
         *  return objarticlestock;
         * }
         *
         */

        public Int64 InsertUpdate(articlestock objarticlestock)
        {
            //id, pid, sizeid, colorid, quantity

            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "articlestock_InsertUpdate";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = ConnectionString;

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@id";
                param.Value         = objarticlestock.id;
                param.SqlDbType     = SqlDbType.Int;
                param.Direction     = ParameterDirection.InputOutput;
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@pid", objarticlestock.pid);
                cmd.Parameters.AddWithValue("@sizeid", objarticlestock.sizeid);
                cmd.Parameters.AddWithValue("@colorid", objarticlestock.colorid);
                cmd.Parameters.AddWithValue("@quantity", objarticlestock.quantity);

                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }
        public Int64 Insert(ProcessMaster objcategory)
        {
            Int64 result = 0;

            try
            {
                SqlCommand cmd = new SqlCommand
                {
                    CommandText = "Process_Insert",
                    CommandType = CommandType.StoredProcedure,
                    Connection  = ConnectionString
                };

                SqlParameter param = new SqlParameter
                {
                    ParameterName = "@id",
                    Value         = objcategory.id,
                    SqlDbType     = SqlDbType.BigInt,
                    Direction     = ParameterDirection.InputOutput
                };
                cmd.Parameters.Add(param);
                cmd.Parameters.AddWithValue("@particular", objcategory.processname);


                ConnectionString.Open();
                cmd.ExecuteNonQuery();
                result = Convert.ToInt64(param.Value);
            }
            catch (Exception ex)
            {
                ErrHandler.writeError(ex.Message, ex.StackTrace);
                return(result);
            }
            finally
            {
                ConnectionString.Close();
            }
            return(result);
        }