예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DeleteTempFolder();

            if (!IsPostBack)
            {
                if (Request["id"].IsInt32())
                {
                    var cardid = UtilityMethod.GetRequestParameter("id", "0").ToInt32();
                    CurrentCard = PostalCard_DataProvider.GetPostalCard(cardid).FirstOrDefault();
                    if (CurrentCard != null)
                    {
                        //var user = OnlineKidsUser.Kids_UserInfo;
                        if (SessionItems.CurrentScore < CurrentCard.CardScore)
                        {
                            ShowMessageBox("شما امتیاز کافی جهت خرید این کارت پستال را ندارید");
                            return;
                        }
                        pnlMain.Visible = true;
                        imgPostalCardSmallPic.ImageUrl = string.Format("{0}/{1}", SystemConfigs.UrlPostalCardFilesPath, CurrentCard.CardPostalSmallPic);
                        txtColor.Text = ColorTranslator.ToHtml(Color.Black).Replace("#", "");
                        txtTop.Text = "10";
                        txtRight.Text = "10";
                        txtFontSize.Text = "30";
                        //txtRotationDegree.Text = "0";
                    }
                    else Response.Redirect("~/PostalCardList.aspx");
                }
                else
                    Response.Redirect("~/PostalCardList.aspx");
            }
        }
 public static void SavePostalCard(PostalCard PostalCard)
 {
     using (var ctx = new BMIKidsEntities(ConnectionString))
     {
         try
         {
             ctx.PostalCards.ApplyChanges(PostalCard);
             ctx.SaveChanges();
         }
         catch (Exception ex)
         {
             LogUtility.WriteEntryEventLog("PostalCard_DataProvider_DataProvider", ex, EventLogEntryType.Information);
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }
예제 #3
0
        private string CreateImage(int Top, int Right, int RotationDegree, string FontName, int fontSize, Color fontColor, PostalCard p, string BodyText)
        {
            var file = MapPath(string.Format("{0}/{1}", SystemConfigs.UrlPostalCardFilesPath, p.CardPostalPic));
            string SavePath = string.Format("{0}Temp/{1}_stamped{2}", SystemConfigs.UrlPostalCardFilesPath, Common.CreateTemporaryPassword(10), Path.GetExtension(file));

            WriteStringOnImage(file, FontName, fontSize, fontColor, BodyText, Right, Top, RotationDegree, MapPath(SavePath));
            return SavePath;
        }