Example #1
0
    protected void grid_DOC_LIST_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
    {
        SqlConnection conn = new SqlConnection(OPM_BL.StaticDefaultConnectionString);
        conn.Open();

        SqlTransaction trans;
        trans = conn.BeginTransaction();

        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandType = CommandType.Text;
        cmd.CommandTimeout = 240;
        cmd.Transaction = trans;
        string sql = "";

        string ID = e.Keys[grid_DOC_LIST.KeyFieldName].ToString();

        try
        {

            sql = "Delete From SMM_DOCUMENT_LIST where doc_id = @_DOC_ID";
            SqlParameter[] param = new SqlParameter[1];
            param[0] = OPM_BL.setParameter("@_DOC_ID", SqlDbType.VarChar, ID);
            cmd.CommandText = sql;
            cmd.Parameters.Clear();
            foreach (SqlParameter p in param)
            {
                if (p != null)
                {
                    cmd.Parameters.Add(p);
                }
            }

            cmd.ExecuteNonQuery();
            trans.Commit();

            BindData();

            e.Cancel = true;
        }
        catch (Exception ex)
        {
            trans.Rollback();
        }

        // ]บรายการไฟล์แนบใบประเมิน
        opmUploadService.ServiceSoapClient s = new opmUploadService.ServiceSoapClient();
        DataTable DT = s.GetAttachment("SMM", "Document", ID.ToString(), "");
        // ลบรายการเอกสาร  ลบ Upload ด้วย
        for (int i = 0; DT.Rows.Count > i; i++)
        {
            string imgID = DT.Rows[i]["IMG_ID"].ToString();
            s.DeleteAttachment(imgID, "");
        }

        LogFileEng.SaveActionTransLog("SMM_UT0111", "DELETE", "Success", "SMM_DOCUMENT_LIST", ID, "", Request);

        e.Cancel = true;
    }
Example #2
0
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        if (DOC_ID().ToString() == "0") {
        // ลบรายการที่กำลังโชว์ในหน้าจอ
            DataTable DT = (DataTable)Session["DTCurrent_dtImages"];
            for (int i = 0; DT.Rows.Count > i; i++) {
                string imgID = DT.Rows[i]["IMG_ID"].ToString();
                opmUploadService.ServiceSoapClient s = new opmUploadService.ServiceSoapClient();
                s.DeleteAttachment(imgID, "");

            }

        }
        LogFileEng.SaveActionTransLog("SMM_UT0111", "BACK", "Back From SMM_DOC", "", "", "", Request);
        Response.Redirect("SMM_DOC_ListView.aspx");
    }
    protected void viewIMAGES_ListView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
    {
        e.Cancel = true;
        string imgID = e.Keys["IMG_ID"].ToString();

        //opmUploadService.Service s = new opmUploadService.Service();
        opmUploadService.ServiceSoapClient s = new opmUploadService.ServiceSoapClient();

        s.DeleteAttachment(imgID, "");

        s = new opmUploadService.ServiceSoapClient();
        DataTable dtImages = s.GetAttachment(SYS_ID, SUB_ID, inputCOMMAND_ID, "");
        //DataTable dtImages = s.GetAttachment(SYS_ID, SUB_ID, "00000", "");
        gv_Upload.DataSource = dtImages;
        gv_Upload.DataBind();

        ScriptManager.RegisterStartupScript(this, this.GetType(), "register", "alert(สำเร็จ);", true);

        //  ScriptManager.RegisterStartupScript(this, this.GetType(), "register", "gv_Upload.Refresh();", true);
    }
    protected void btnBack_Click(object sender, EventArgs e)
    {
        if (REQ_ID().ToString() == "0")
        {
            // ลบรายการที่กำลังโชว์ในหน้าจอ
            DataTable DT = (DataTable)Session["DTCurrent_dtImages"];
            for (int i = 0; DT.Rows.Count > i; i++)
            {
                string imgID = DT.Rows[i]["IMG_ID"].ToString();
                opmUploadService.ServiceSoapClient s = new opmUploadService.ServiceSoapClient();
                s.DeleteAttachment(imgID, "");

            }

        }

        if (role() == "other")
        {
            Response.Redirect("SMM_PER_PROMOTE_PROJECT_ListView.aspx");
        }
        else
        {
            Response.Redirect("SMM_PER_PROMOTE_REQ_ListView.aspx?role=" + role());
        }
        LogFileEng.SaveActionTransLog(lblFormCode.Text.Replace("(", "").Replace(")", ""), "BACK", "", "", "", "", Request);
    }