コード例 #1
0
        internal int IUDEstoreConfig(BOMerchantEstoreConfig _bomecnfg)
        {
            int returnvalue = default(int);

            using (SqlConnection _sqlcon = ConnectionInfo.GetConnection())
            {
                _sqlcommond             = new SqlCommand();
                _sqlcommond.CommandText = "SP_IUDEstoreConfig";
                _sqlcommond.CommandType = CommandType.StoredProcedure;
                _sqlcommond.Connection  = _sqlcon;

                _sqlcon.Open();

                _sqlcommond.Parameters.AddWithValue("@EstroeConfigId", _bomecnfg.EstroeConfigId);
                _sqlcommond.Parameters.AddWithValue("@QuestionNumber", _bomecnfg.QuestionNumber);
                _sqlcommond.Parameters.AddWithValue("@Price", _bomecnfg.Price);
                _sqlcommond.Parameters.AddWithValue("@ExamPicture", _bomecnfg.ExamPicture);
                _sqlcommond.Parameters.AddWithValue("@ExamDescription", _bomecnfg.ExamDescription);
                _sqlcommond.Parameters.AddWithValue("@ExamId", _bomecnfg.ExamId);
                _sqlcommond.Parameters.AddWithValue("@MerchantId", _bomecnfg.MerchantId);
                _sqlcommond.Parameters.AddWithValue("@IsActive", _bomecnfg.IsActive);
                _sqlcommond.Parameters.AddWithValue("@IsDelete", _bomecnfg.IsDelete);
                _sqlcommond.Parameters.AddWithValue("@CreatedBy", _bomecnfg.Createdby);
                _sqlcommond.Parameters.AddWithValue("@CreatedDate", _bomecnfg.CreatedDate);
                _sqlcommond.Parameters.AddWithValue("@UpdatedBy", _bomecnfg.UpdatedBy);
                _sqlcommond.Parameters.AddWithValue("@UpdatedDate", _bomecnfg.UpdatedDate);
                _sqlcommond.Parameters.AddWithValue("@Event", _bomecnfg.Event);
                _sqlcommond.Parameters.AddWithValue("@returnValue", 0).Direction = System.Data.ParameterDirection.InputOutput;

                try
                {
                    _sqlcommond.ExecuteNonQuery();
                    returnvalue = Convert.ToInt32(_sqlcommond.Parameters["@returnValue"].Value);
                }
                catch (SqlException sqlex)
                {
                    Common.LogError(sqlex);
                }
                catch (StackOverflowException stackex)
                {
                    Common.LogError(stackex);
                }
                catch (Exception ex)
                {
                    Common.LogError(ex);
                }
                finally
                {
                    _sqlcon.Close();
                    _sqlcommond.Dispose();
                }
            }
            return(returnvalue);
        }
コード例 #2
0
        public static string InsertConfigData(int Examid, int Questiono, decimal Price, string ExamPic, string ExamDes)
        {
            string status = string.Empty;

            try
            {
                String path = HttpContext.Current.Server.MapPath("~/img_exmestoreconfig"); //Path
                                                                                           //Check if directory exist
                if (!System.IO.Directory.Exists(path))
                {
                    System.IO.Directory.CreateDirectory(path); //Create directory if it doesn't exist
                }
                string imagename = Common.AppendTimeStamp("exmpic.png");
                string imgPath   = Path.Combine(path, imagename);
                // string convert = ExamPic.Replace("data:image/png;base64,", String.Empty);
                string convert    = ExamPic.Split(',')[1];
                byte[] imageBytes = Convert.FromBase64String(convert);
                File.WriteAllBytes(imgPath, imageBytes);

                BOMerchantEstoreConfig _bomecnfg = new BOMerchantEstoreConfig();
                BAMerchantEstoreConfig _bamecnfg = new BAMerchantEstoreConfig();
                _bomecnfg.QuestionNumber  = Questiono;
                _bomecnfg.Price           = Price;
                _bomecnfg.ExamPicture     = imagename;
                _bomecnfg.ExamDescription = ExamDes;
                _bomecnfg.ExamId          = Examid;
                _bomecnfg.MerchantId      = MerchantId;
                _bomecnfg.IsActive        = true;
                _bomecnfg.IsDelete        = false;
                _bomecnfg.Createdby       = MerchantId;
                _bomecnfg.CreatedDate     = DateTime.UtcNow;
                _bomecnfg.UpdatedBy       = MerchantId;
                _bomecnfg.UpdatedDate     = DateTime.UtcNow;
                _bomecnfg.Event           = "Insert";
                if (_bamecnfg.Insert(_bomecnfg) == 1)
                {
                    status = "Insert successfully";
                }
            }
            catch (Exception ex)
            {
                Common.LogError(ex);
                status = ex.ToString();;
            }
            return(status);
        }
コード例 #3
0
 internal int Insert(BOMerchantEstoreConfig _bomecnfg)
 {
     return(_damecnfg.IUDEstoreConfig(_bomecnfg));
 }