public ActionResult NewConsumableIssued(ssmtbl_ConsumablesIssuedModel objConsumeMod)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string result = objConsumableList.InsertConsumableIssued(objConsumeMod);
                    if (result == "ConsumableIssued Created Successfully!")
                    {
                        ModelState.Clear();
                        objConsumeMod            = new ssmtbl_ConsumablesIssuedModel();
                        objConsumeMod.IssuedDate = DateTime.Now;
                        @ViewBag.HideClass       = "alert alert-success";
                        @ViewBag.Message         = result;
                    }
                    else
                    {
                        @ViewBag.HideClass = "alert alert-danger";
                        @ViewBag.Message   = result;
                    }
                }
            }
            catch (Exception ex)
            {
                Global.ErrorHandlerClass.LogError(ex);
                @ViewBag.HideClass = "alert alert-danger";
                @ViewBag.Message   = "ConsumableIssued Not Created!";
            }


            return(View(objConsumeMod));
        }
        public ActionResult NewConsumableIssued()
        {
            ssmtbl_ConsumablesIssuedModel objConsumeMod = new ssmtbl_ConsumablesIssuedModel();

            objConsumeMod.IssuedDate = DateTime.Now;
            return(View(objConsumeMod));
        }
예제 #3
0
        public List <ssmtbl_ConsumablesIssuedModel> GetAllConsumablesIssuedList()
        {
            List <ssmtbl_ConsumablesIssuedModel> objConsumablesList = new List <ssmtbl_ConsumablesIssuedModel>();

            try
            {
                string sqlstr     = "ssmsp_Get_AllConsumableIssuedList";
                var    connection = gConnection.Connection();
                connection.Open();
                SqlCommand cmd = new SqlCommand(sqlstr, connection);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Action", "select");
                SqlDataReader sdr = cmd.ExecuteReader();
                while (sdr.Read())
                {
                    ssmtbl_ConsumablesIssuedModel objtemp = new ssmtbl_ConsumablesIssuedModel();
                    objtemp.ID         = sdr["ID"].ToString();
                    objtemp.Code       = sdr["Code"].ToString();
                    objtemp.IssuedTo   = sdr["IssuedTo"].ToString();
                    objtemp.IssuedDate = Convert.ToDateTime(sdr["IssuedDate"].ToString());
                    var qty = (sdr["IssuedQuantity"].ToString());
                    objtemp.IssuedQuantity = qty == "" ? "0" : qty;
                    objtemp.Flag           = sdr["Flag"].ToString();
                    objtemp.Description    = sdr["Description"].ToString();
                    objConsumablesList.Add(objtemp);
                }
                connection.Close();
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(objConsumablesList);
        }
예제 #4
0
        public List <ssmtbl_ConsumablesIssuedModel> GetItemsByCode(string Prefix)
        {
            List <ssmtbl_ConsumablesIssuedModel> objConsumablesList = new List <ssmtbl_ConsumablesIssuedModel>();

            try
            {
                string sqlstr     = "ssmsp_Get_AllConsumableIssuedList";
                var    connection = gConnection.Connection();
                connection.Open();
                SqlCommand cmd = new SqlCommand(sqlstr, connection);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@itemcode", Prefix);
                cmd.Parameters.AddWithValue("@Action", "autofetchitemcode");
                SqlDataReader sdr = cmd.ExecuteReader();
                while (sdr.Read())
                {
                    ssmtbl_ConsumablesIssuedModel objtemp = new ssmtbl_ConsumablesIssuedModel();
                    objtemp.ID   = sdr["ID"].ToString();
                    objtemp.Code = sdr["Code"].ToString();
                    var qty = (sdr["BalanceQunatity"].ToString());
                    objtemp.BalanceQunatity = qty == "" ? "0" : qty;
                    objtemp.Description     = sdr["Description"].ToString();
                    objConsumablesList.Add(objtemp);
                }
                connection.Close();
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(objConsumablesList);
        }
예제 #5
0
        public string InsertConsumableIssued(ssmtbl_ConsumablesIssuedModel objConsumeMod)
        {
            string result = "Error Inserting ConsumableIssued";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                string     sqlstr = "ssmsp_Get_AllConsumableIssuedList";
                SqlCommand cmd    = new SqlCommand(sqlstr, GlobalVariables.gConn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Code", objConsumeMod.Code);
                cmd.Parameters.AddWithValue("@IssuedTo", objConsumeMod.IssuedTo);
                cmd.Parameters.AddWithValue("@IssuedDate", objConsumeMod.IssuedDate);
                cmd.Parameters.AddWithValue("@IssuedQuantity", objConsumeMod.IssuedQuantity);
                cmd.Parameters.AddWithValue("@IssuedBy", objConsumeMod.IssuedBy);
                cmd.Parameters.AddWithValue("@Flag ", "1");
                cmd.Parameters.AddWithValue("@CreatedBy", objConsumeMod.CreatedBy);
                cmd.Parameters.AddWithValue("@CreatedDate", StandardDateTime.GetDateTime());
                cmd.Parameters.AddWithValue("@UpdatedBy", objConsumeMod.UpdatedBy);
                cmd.Parameters.AddWithValue("@UpdatedDate", StandardDateTime.GetDateTime());
                cmd.Parameters.AddWithValue("@Description ", objConsumeMod.Description);
                cmd.Parameters.AddWithValue("@Action ", "insert");

                cmd.ExecuteNonQuery();
                connection.Close();
                result = "ConsumableIssued Created Successfully!";
            }
            catch (Exception ex)
            {
                Global.ErrorHandlerClass.LogError(ex);
            }
            return(result);
        }