public Model_Template model_InsertEmailEelement(Model_Template el) { int ret = 0; DateTime d = DatetimeHelper._UTCNow(); string filename = d.ToString("ddmmyyyyhhmmss") + ".jpg"; using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand(@"INSERT INTO Template (EID,CreatedDate,CreateBy,Title,Description,DemoPath,DemoFileName) VALUES(@EID,@CreatedDate,@CreateBy,@Title,@Description,@DemoPath,@DemoFileName) ; SET @TID = SCOPE_IDENTITY(); ", cn); cmd.Parameters.Add("@EID", SqlDbType.NVarChar).Value = el.EID; cmd.Parameters.Add("@CreatedDate", SqlDbType.SmallDateTime).Value = el.CreatedDate; cmd.Parameters.Add("@CreateBy", SqlDbType.NVarChar).Value = el.CreateBy; cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = el.Title; cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = el.Description; cmd.Parameters.Add("@DemoPath", SqlDbType.NVarChar).Value = AppTools.TemplateMockPath(); cmd.Parameters.Add("@DemoFileName", SqlDbType.NVarChar).Value = filename; cmd.Parameters.Add("@TID", SqlDbType.Int).Direction = ParameterDirection.Output; cn.Open(); if (ExecuteNonQuery(cmd) > 0) { ret = (int)cmd.Parameters["@TID"].Value; // string fullpath = AppTools.TemplateMockPath() + "test.png"; HtmlToImage.ConvertHtmlToImage(AppTools.TemplateMockPath(), filename, el.EL.html); } el.DemoPath = AppTools.TemplateMockPath(); el.DemoFileName = filename; el.TID = ret; } return(el); }
public int UpdatePayment(int intPaymentID) { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand(@"UPDATE OrderPayment SET ComfirmPayment=@ComfirmPayment WHERE PaymentID=@PaymentID", cn); cmd.Parameters.Add("@PaymentID", SqlDbType.Int).Value = intPaymentID; cmd.Parameters.Add("@ComfirmPayment", SqlDbType.SmallDateTime).Value = DatetimeHelper._UTCNow(); cn.Open(); return(ExecuteNonQuery(cmd)); } }
protected void btnPubish_Click(object sender, EventArgs e) { Model_Post p = new Model_Post { PostTypeID = byte.Parse(Request.QueryString["PostTypeID"]), Title = txtTitle.Text.Trim(), Short = "", Slug = txtTitle.Text.GenerateSlug(), DateSubmit = DatetimeHelper._UTCNow(), UserID = this.UserActive.UserID, DatePublish = DatetimeHelper._UTCNow(), Status = bool.Parse(dropStatus.SelectedValue), ShowComment = false, BodyContent = txtContent.Text.Trim(), BodyContentBuilder = "", BannerTypeID = byte.Parse(CoverType.Value), ShowMasterSlider = bool.Parse(radioshowmMS.SelectedValue), ViewCount = 1 }; int postid = p.InsertPost(p); if (postid > 0 && byte.Parse(Request.QueryString["PostTypeID"]) == (byte)PostType.Products) { Model_PostPricing pp = new Model_PostPricing { PostID = postid, Isvat = true, Price = 0.0m, PostTypeID = (byte)PostType.Products, Title = string.Empty }; pp.InsertPrice(pp); } if (postid > 0) { Response.Redirect("Post?PostID=" + postid); } //Response.Write(txtContent.Text); //Response.End(); }