Ejemplo n.º 1
0
 public String Upadte_AssetType(asset_info ai)
 {
     try
     {
         SqlCommand cmd = new SqlCommand("pro_Update_Asset_type", amon);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("@type_id", ai.Asset_id));
         cmd.Parameters.Add(new SqlParameter("@type_name", ai.AS_TYPE));
         amon.Open();
         return(cmd.ExecuteScalar().ToString());
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         amon.Close();
     }
 }
Ejemplo n.º 2
0
        // public static string conect = getcon();
        ////SqlConnection amon = new SqlConnection(conect);
        // public static string getcon()
        // {
        //     string connectee = string.Empty;
        //     string[] lines = System.IO.File.ReadAllLines(@"C:\Users\ahammed.2921\Documents\GitHub\AM\AM\database.txt");
        //    // string[] le = File.ReadLines(-Path)
        //     foreach (string line in lines)
        //     {
        //         string[] linesa = lines;
        //         connectee = linesa[0].ToString();

        //     }
        //     return connectee;
        // }

        #region cpu area
        public String insertAssertid(asset_info ai)
        {
            try
            {
                //  amon = new SqlConnection(amsql.getcon());
                SqlCommand cmd = new SqlCommand("pro_insert_Asset_id", amon);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@As_AssetCode", ai.AS_ASSETCODE));
                cmd.Parameters.Add(new SqlParameter("@As_Type", ai.AS_TYPE));
                cmd.Parameters.Add(new SqlParameter("@As_IsActive", 1));
                cmd.Parameters.Add(new SqlParameter("@As_CreatedBy", "ahammed"));
                cmd.Parameters.Add(new SqlParameter("@As_CreatedTime", DateTime.Now));
                amon.Open();
                return(cmd.ExecuteScalar().ToString());
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                amon.Close();
            }
        }
Ejemplo n.º 3
0
        protected void btn_model_save_amms_Click(object sender, EventArgs e)
        {
            if (btn_model_save_amms.Text == "Save")
            {
                if (!string.IsNullOrWhiteSpace(txt_Model_amms.Text.ToString()))
                {
                    objs.Mo_Name       = txt_Model_amms.Text.ToString().TrimEnd().TrimStart();
                    objs.Mo_br_id      = Convert.ToInt32(ddl_brands_amms.SelectedItem.Value);
                    objs.Mo_created_by = "Ahammed syed";
                    int    i          = amdb._insert_model_info(objs);
                    string strmessage = "";
                    if (i == 1)
                    {
                        strmessage = "New Model  " + txt_Model_amms.Text + "     Was Inserted";
                        ScriptManager.RegisterClientScriptBlock(btn_model_save_amms, this.GetType(), "AlertMsg", "<script language='javascript'>alert('" + strmessage + "');</script>", false);
                        txt_Model_amms.Text = string.Empty;
                        //   _load_products_grid();
                        //   _load_products_ddl();
                    }
                    else if (i == 0)
                    {
                        strmessage = txt_Model_amms.Text + "  " + "  ---- Already we have -- Try a New One";
                        ScriptManager.RegisterClientScriptBlock(btn_model_save_amms, this.GetType(), "AlertMsg", "<script language='javascript'>alert('" + strmessage + "');</script>", false);
                        //  _load_products_grid();
                        //  _load_products_ddl();
                        txt_Model_amms.Text = string.Empty;
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(btn_model_save_amms, this.GetType(), "AlertMsg", "<script language='javascript'>alert('Some Thing Went Wrong');</script>", false);
                        txt_Model_amms.Text = string.Empty;
                        //  _load_products_grid();
                        //  _load_products_ddl();
                    }
                }
                else
                {
                    string textmess = "Please Enter Text";
                    ScriptManager.RegisterClientScriptBlock(btn_model_save_amms, this.GetType(), "AlertMsg", "<script language='javascript'>alert('" + textmess + "');</script>", false);
                }
            }
            if (btn_model_save_amms.Text == "Update")
            {
                if (!string.IsNullOrWhiteSpace(txt_Model_amms.Text.ToString()))
                {
                    asset_info ais = new asset_info();
                    ais.Asset_id = Convert.ToInt32(lbl_id.Text);
                    ais.AS_TYPE  = txt_Model_amms.Text.TrimEnd(' ');


                    String i = adt.Upadte_AssetType(ais);
                    if (i == "1")
                    {
                        string str1message = "New  " + txt_Model_amms.Text + "     Was Updated";
                        ScriptManager.RegisterClientScriptBlock(btn_model_save_amms, this.GetType(), "AlertMsg", "<script language='javascript'>alert('" + str1message + "');</script>", false);
                        btn_model_save_amms.Text = "Save";
                        //_load_products_grid();
                        //  _load_products_ddl();
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(btn_model_save_amms, this.GetType(), "AlertMsg", "<script language='javascript'>alert('" + i + "');</script>", false);
                        btn_model_save_amms.Text = "Save";
                        txt_Model_amms.Text      = string.Empty;
                        //     _load_products_grid();
                        //    _load_products_ddl();
                    }
                }
                else
                {
                    string textmess = "Please Enter Text";
                    ScriptManager.RegisterClientScriptBlock(btn_model_save_amms, this.GetType(), "AlertMsg", "<script language='javascript'>alert('" + textmess + "');</script>", false);
                }
            }
        }