Пример #1
0
    protected void grdAttachment_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        e.Row.Cells[0].Visible = false;
        e.Row.Cells[1].Visible = false;
        e.Row.Cells[2].Visible = false;
        e.Row.Cells[3].Visible = false;

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ((LinkButton)e.Row.Cells[6].Controls[0]).Attributes.Add("onclick", "return confirm('Do you really want to delete?');");

            ATTGeneralTippaniAttachment attach = e.Row.DataItem as ATTGeneralTippaniAttachment;
            System.Drawing.Color        c      = BLLGeneralTippani.GetActionColor(attach.Action);
            e.Row.ForeColor = c;

            if (attach.Action == "D")
            {
                ((LinkButton)e.Row.Cells[6].Controls[0]).Text = "Undo";
            }
            else if (attach.Action == "N" || attach.Action == "A" || attach.Action == "E")
            {
                ((LinkButton)e.Row.Cells[6].Controls[0]).Text = "Delete";
            }
        }
    }
Пример #2
0
        public static List <ATTGeneralTippaniAttachment> GetAttachment(ATTGeneralTippaniAttachment attach, string tippaniList)
        {
            List <ATTGeneralTippaniAttachment> lst = new List <ATTGeneralTippaniAttachment>();

            try
            {
                if (tippaniList != "")
                {
                    tippaniList = tippaniList.Remove(tippaniList.LastIndexOf(','), 2);

                    DataTable tbl = DLLGeneralTippaniAttachment.GetAttachment(attach);
                    foreach (DataRow row in tbl.Rows)
                    {
                        ATTGeneralTippaniAttachment attachment = new ATTGeneralTippaniAttachment();
                        attachment.OrgID            = int.Parse(row["org_id"].ToString());
                        attachment.TippaniID        = int.Parse(row["tippani_id"].ToString());
                        attachment.TippaniProcessID = int.Parse(row["tippani_process_id"].ToString());
                        attachment.AttachmentID     = int.Parse(row["attachment_id"].ToString());
                        attachment.DocumentName     = row["doc_name"].ToString();
                        attachment.Description      = row["Description"].ToString();
                        attachment.Action           = "N";

                        lst.Add(attachment);
                    }
                }
                return(lst);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (this.fupAttachment.HasFile == false)
        {
            this.lblStatusMessage.Text = "कृपया कागजपत्र दिनुहोस।";
            this.programmaticModalPopup.Show();
            return;
        }

        List <ATTGeneralTippaniAttachment> lst = Session["Tippani_Attachment"] as List <ATTGeneralTippaniAttachment>;

        ATTGeneralTippaniAttachment attachment = new ATTGeneralTippaniAttachment();

        attachment.OrgID            = 0;
        attachment.TippaniID        = 0;
        attachment.TippaniProcessID = 0;
        attachment.AttachmentID     = 0;
        attachment.DocumentName     = this.fupAttachment.FileName;
        attachment.Description      = this.txtDescription.Text;
        attachment.RawContent       = this.fupAttachment.FileBytes;
        attachment.Action           = "A";
        lst.Add(attachment);

        this.grdAttachment.DataSource = lst;
        this.grdAttachment.DataBind();

        this.txtDescription.Text = "";
    }
Пример #4
0
    protected void grdAttachment_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        List <ATTGeneralTippaniAttachment> lst      = Session["Tippani_Attachment"] as List <ATTGeneralTippaniAttachment>;
        ATTGeneralTippaniAttachment        currentO = lst[e.RowIndex];
        GridViewRow CurrentRow = this.grdAttachment.Rows[e.RowIndex];

        int DelCmdIndex = 6;

        if (currentO.Action == "A")
        {
            GC.Collect();
            GC.SuppressFinalize(lst[e.RowIndex].RawContent);
            lst[e.RowIndex].RawContent = null;

            lst.RemoveAt(e.RowIndex);
            this.grdAttachment.DataSource = lst;
            this.grdAttachment.DataBind();
        }
        else if (currentO.Action == "N" || currentO.Action == "D" || currentO.Action == "E")
        {
            if (((LinkButton)CurrentRow.Cells[DelCmdIndex].Controls[0]).Text == "Delete")
            {
                lst[e.RowIndex].Action        = "D";
                this.grdAttachment.DataSource = lst;
                this.grdAttachment.DataBind();
            }
            else if (((LinkButton)CurrentRow.Cells[DelCmdIndex].Controls[0]).Text == "Undo")
            {
                lst[e.RowIndex].Action        = "N";
                this.grdAttachment.DataSource = lst;
                this.grdAttachment.DataBind();
            }
        }
    }
Пример #5
0
        public static DataTable GetAttachment(ATTGeneralTippaniAttachment attach)
        {
            string SQL = "SELECT * FROM VW_TIPPANI_ATTACHMENT_INFO WHERE 1 = 1";

            SQL = SQL + " AND ORG_ID = " + attach.OrgID.ToString();
            SQL = SQL + " AND TIPPANI_ID = " + attach.TippaniID.ToString();

            try
            {
                return(SqlHelper.ExecuteDataset(CommandType.Text, SQL, Module.OAS, null).Tables[0]);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #6
0
    public void LoadAttachmentFromDartaaChalaani(int orgID, string regDate, int regNo)
    {
        try
        {
            List <ATTDartaaChalaani>           dlist = BLLDartaaChalaani.GetDartaaChalaaniByIDs(orgID, regDate, regNo);
            List <ATTGeneralTippaniAttachment> lst   = new List <ATTGeneralTippaniAttachment>();
            foreach (ATTDartaaChalaani att in dlist)
            {
                if (att.FileName != "" && att.RegFile != null)
                {
                    ATTGeneralTippaniAttachment ah = new ATTGeneralTippaniAttachment();
                    ah.OrgID            = 0;
                    ah.TippaniID        = 0;
                    ah.TippaniProcessID = 0;
                    ah.AttachmentID     = 0;
                    ah.DocumentName     = att.FileName;
                    ah.Description      = "";
                    ah.RawContent       = att.RegFile;
                    ah.Action           = "A";
                    lst.Add(ah);
                }
            }

            foreach (ATTDartaaChalaani attach in dlist)
            {
                if (attach.RegFile != null)
                {
                    GC.Collect();
                    GC.SuppressFinalize(attach.RegFile);
                    attach.RegFile = null;
                }
            }

            this.grdAttachment.DataSource = lst;
            this.grdAttachment.DataBind();
            Session["Tippani_Attachment"] = lst;
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
Пример #7
0
    public void LoadTippaniAttachmentDetail(int orgID, int tippaniID)
    {
        ATTGeneralTippaniAttachment info = new ATTGeneralTippaniAttachment();

        info.OrgID     = orgID;
        info.TippaniID = tippaniID;

        try
        {
            List <ATTGeneralTippaniAttachment> lst = BLLGeneralTippaniAttachment.GetAttachment(info, tippaniID.ToString() + ", ");
            this.grdAttachment.DataSource = lst;
            this.grdAttachment.DataBind();
            Session["Tippani_Attachment"] = lst;
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
Пример #8
0
    public void LoadAttachmentFromMessage(int orgID, int msgID)
    {
        try
        {
            List <ATTMessageAttachment>        mlist = BLLMessageAttachment.GetMsgAttachmentByIDs(orgID, msgID);
            List <ATTGeneralTippaniAttachment> lst   = new List <ATTGeneralTippaniAttachment>();
            foreach (ATTMessageAttachment att in mlist)
            {
                ATTGeneralTippaniAttachment ah = new ATTGeneralTippaniAttachment();
                ah.OrgID            = 0;
                ah.TippaniID        = 0;
                ah.TippaniProcessID = 0;
                ah.AttachmentID     = 0;
                ah.DocumentName     = att.FileName;
                ah.Description      = "";
                ah.RawContent       = att.ContentFile;
                ah.Action           = "A";
                lst.Add(ah);
            }

            foreach (ATTMessageAttachment attach in mlist)
            {
                if (attach.ContentFile != null)
                {
                    GC.Collect();
                    GC.SuppressFinalize(attach.ContentFile);
                    attach.ContentFile = null;
                }
            }

            this.grdAttachment.DataSource = lst;
            this.grdAttachment.DataBind();
            Session["Tippani_Attachment"] = lst;
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
        public static List <ATTGeneralTippaniRequestInfo> GetTippaniRequestInfoList(ATTGeneralTippaniRequestInfo info, int sIndex, int eIndex, ref decimal totalRecord)
        {
            List <ATTGeneralTippaniRequestInfo> lst = new List <ATTGeneralTippaniRequestInfo>();

            try
            {
                DataTable tbl = new DataTable();

                if (info.RequestType == TippaniProcessRequestType.Request)
                {
                    tbl = DLLGeneralTippaniRequestInfo.GetTippaniRequestInfo(info, sIndex, eIndex, ref totalRecord);
                }
                else if (info.RequestType == TippaniProcessRequestType.History)
                {
                    tbl = DLLGeneralTippaniRequestInfo.GetTippaniRequestHistory(info);
                }

                string tippaniList = "";

                foreach (DataRow row in tbl.Rows)
                {
                    ATTGeneralTippaniRequestInfo obj = new ATTGeneralTippaniRequestInfo();

                    obj.OrgID              = int.Parse(row["org_id"].ToString());
                    obj.TippaniID          = int.Parse(row["tippani_id"].ToString());
                    obj.TippaniProcessID   = int.Parse(row["tippani_process_id"].ToString());
                    obj.ProcessByID        = (row["process_by_id"].ToString() == "") ? 0 : double.Parse(row["process_by_id"].ToString());
                    obj.ProcessBy          = row["process_by"].ToString();
                    obj.IsChannelPerson    = row["is_channel_person"].ToString();
                    obj.TippaniSubject     = row["tippani_text"].ToString();
                    obj.ProcessOn          = row["send_on"].ToString();
                    obj.ProcessToID        = double.Parse(row["process_to_id"].ToString());
                    obj.ProcessTo          = row["process_to"].ToString();
                    obj.TippaniSubjectID   = int.Parse(row["tippani_subject_id"].ToString());
                    obj.TippaniSubjectName = row["tippani_subject_name"].ToString();
                    obj.TippaniStatusID    = int.Parse(row["tippani_status_ID"].ToString());
                    obj.TippaniStatusName  = row["tippani_status_Name"].ToString();
                    obj.ProcessStatusID    = (row["process_status_ID"].ToString() == "") ? 0 : int.Parse(row["process_status_ID"].ToString());
                    obj.ProcessStatusName  = row["process_status_Name"].ToString();
                    obj.Note             = row["note"].ToString();
                    obj.SenderOrgID      = (row["sender_org_id"].ToString() == "") ? 0 : int.Parse(row["sender_org_id"].ToString());
                    obj.SenderUnitID     = (row["sender_unit_id"].ToString() == "") ? 0 : int.Parse(row["sender_unit_id"].ToString());
                    obj.SenderOrgName    = row["sender_org_name"].ToString();
                    obj.SenderUnitName   = row["sender_unit_name"].ToString();
                    obj.ReceiverOrgID    = int.Parse(row["receiver_org_id"].ToString());
                    obj.ReceiverUnitID   = int.Parse(row["receiver_unit_id"].ToString());
                    obj.ReceiverOrgName  = row["receiver_org_name"].ToString();
                    obj.ReceiverUnitName = row["receiver_unit_name"].ToString();

                    tippaniList = tippaniList + obj.TippaniID.ToString() + ", ";

                    lst.Add(obj);
                }

                if (info.RequestType == TippaniProcessRequestType.History)
                {
                    ATTGeneralTippaniAttachment infox = new ATTGeneralTippaniAttachment();
                    infox.OrgID     = info.OrgID;
                    infox.TippaniID = info.TippaniID;
                    List <ATTGeneralTippaniAttachment> lstAttachment = BLLGeneralTippaniAttachment.GetAttachment(infox, tippaniList);

                    foreach (ATTGeneralTippaniRequestInfo request in lst)
                    {
                        request.LstAttachment = lstAttachment.FindAll
                                                (
                            delegate(ATTGeneralTippaniAttachment a)
                        {
                            return(a.OrgID == request.OrgID &&
                                   a.TippaniID == request.TippaniID &&
                                   a.TippaniProcessID == request.TippaniProcessID);
                        }
                                                );
                    }
                }

                return(lst);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }