Example #1
0
        public JsonResult util_dropdown_setting_up(util_dropdown_view_lib obj)
        {
            obj.company_id = Convert.ToInt32(Crypto.url_decrypt(Request.Cookies["CompanyId"]));
            obj.created_by = Convert.ToInt32(Crypto.url_decrypt(Request.Cookies["UserId"]));
            var        result = _master.util_dropdown_setting_upAsync(obj).Result;
            JsonResult json   = Json(result);

            return(json);
        }
        public int util_dropdown_setting_in(util_dropdown_view_lib obj)
        {
            int            ret   = 1;
            SqlConnection  oConn = new SqlConnection(_master);
            SqlTransaction oTrans;

            oConn.Open();
            oTrans = oConn.BeginTransaction();
            SqlCommand oCmd = new SqlCommand();

            oCmd.Connection  = oConn;
            oCmd.Transaction = oTrans;

            oCmd.CommandText = "util_dropdown_setting_in";
            oCmd.CommandType = CommandType.StoredProcedure;
            oCmd.Parameters.Clear();
            oCmd.Parameters.AddWithValue("@setting_type", obj.setting_id_ds);
            oCmd.Parameters.AddWithValue("@description", obj.description);
            oCmd.Parameters.AddWithValue("@company_id", obj.company_id);
            oCmd.Parameters.AddWithValue("@active", obj.active_ds);
            oCmd.Parameters.AddWithValue("@created_by", obj.created_by);
            try
            {
                oCmd.ExecuteNonQuery();
                oTrans.Commit();
            }
            catch (Exception e)
            {
                ret = 0;
                Console.WriteLine("Error: " + e.Message);
                error_log_in("0", "SP = util_dropdown_setting_in | " + e.Message, obj.company_id, obj.created_by);
                oTrans.Rollback();
            }
            finally
            {
                oConn.Close();
            }
            return(ret);
        }